Thursday, July 28, 2011

Re: Extending Reusable App Models

On 27/07/2011 23:29, Django Grappelli wrote:
> Hi All,
> I'm working with a reusable Django application which defines a model that I'd like to extend. I've read through the documentation on model
> inheritance <https://docs.djangoproject.com/en/dev/topics/db/models/#model-inheritance> but haven't found what I'm looking for. I'd like to
> be able to subclass the model so as to add a few fields to it, but I only want to create one table for the model. Is there any way around this?
> DG
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

I'm not sure I understand your question correctly, but I'll try to answer.
Your base class will have something like this:
...
class Meta:
abstract = True

So no table will be made for the base class.

Cheers,
Benedict

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment