Re: Subclassing models.Model to extend base functionalities and attributes

2010-05-11 Thread thierry
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

Re: Subclassing models.Model to extend base functionalities and attributes

2010-05-07 Thread zinckiwi
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,

Subclassing models.Model to extend base functionalities and attributes

2010-05-07 Thread thierry
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