Possible Duplicate:
Django models.Model superclass
By default, if you inherit a model class, django will create a separate table for the base class. Is there any way to use base class (so that I can have the same columns in all derived models), but NOT have django create that base table, but instead, create derived tables with all those same columns?
For example:
class MyBaseModel(models.Model):
createdate = models.DateTimeField(auto_now_add=True)
class A(MyBaseModel):
nameA ...
class B(MyBaseModel):
nameB ...
#I want 2 tables created, A with 2 columns(nameA, createdate) and B with 2 columns.
Is this possible?
Yes. Read the docs: https://docs.djangoproject.com/en/dev/topics/db/models/#model-inheritance
The base classes should contain: