Tutorial :Django Model subclass without changing database name


I am making a Django Model decorator which takes a Django model and gives it a few extra methods.

Django creates the database name for this Model using: '%s_%s' % (app_name, class_name). When you decorate the Model the table name is suddenly derived from the app name and class name of the decorator rather than the original class (which is pythonically correct).

However I would like to maintain the original table name of the Model, is there a way to tell Django to use the super class to determin the database name, or a way to retrieve the table name and apply it in the model's Meta class.


You can override this in class Meta:


To make a new model using the specs of the superclass, look into proxy = True


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »