Are you asking about factoring out certain common functionality shared
between models? It's quite common; for example most of my projects
have something like this as a starting point for many models:
class DatestampedModel(models.Model):
created = models.DateTimeField(default=datetime.now, editable=False)
modified = ModifiedField(editable=False)
class Meta:
abstract = True
ordering = ('-created',)
class MyActualModel(DatestampedModel)
...
Note the difference between abstract base classes and multi-table
inheritance:
http://docs.djangoproject.com/en/1.1/topics/db/models/#id6
Regards
Scott
On May 7, 7:08 am, thierry <[email protected]> wrote:
> Hi everybody,
>
> Is there a way to subclass the 'models.Model' class behavior to
> extend
> base functionnalities and attributes to all classes contained in an
> application model ? It seems that the metaclass mechanism force the
> Python inheritance notation to a Database model inheritance.
>
> Thanks,
>
> Thierry.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group
> athttp://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.