Re: Multiple model inheritance
I'm not sure that's possible. Even abstract Models do magic in the background. Specifically there's the _meta class attribute that gets inherited. If you were to try it, only one of the _metas would be included.
On Dec 31, 2012, at 6:12 AM, Mattias Linnap wrote:
> Hi all,
>
> I would like to define multiple abstract base models with small set of
> fields each. The "real" models inherit from multiple mixins to add the
> fields.
>
> For example:
> class Taggable(?):
> tag = models.CharField()
> class Visible(?):
> visible = models.BooleanField()
> class SomeFullModel(?, Taggable, Visible):
> otherfield = models.CharField()
>
> With this use case:
> * should the abstract models inherit from models.Model, or be a plain
> Python class inheriting from object?
> * should all or any of the abstract models have a class Meta with
> abstract=True?
> * should the final real model inherit from models.Model (probably
> required if all the mixins are plain classes), or inherit from the
> first mixin that is an abstract model?
> * does the order of the base classes in SomeFullModel matter?
>
> Thanks,
>
> Mattias
>
> --
> 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.
>
Peter of the Norse
RahmCoff@Radio1190.org
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home