No, I don't talk about model inheritance. Mainly because base class
fields are propagated to subclasses. I'd like to overload some base
methods of the "models.Model" class to making them available from all
classes of a model.
But a metaclass mechanism makes overloading impossible because it
forces
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,
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,
Thierr
3 matches
Mail list logo