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.

Answers


You can override this in class Meta:

http://docs.djangoproject.com/en/1.1/ref/models/options/#django.db.models.Options.db_table

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

http://docs.djangoproject.com/en/1.1/topics/db/models/#id8


Need Your Help

AFNetworking vs BaaS?

ios json cocoa-touch afnetworking mbaas

I'm planning to build a simple social app that can allow users to send pictures and text messages. By doing some research I found some people use Backend as a Service(BaaS) to manage database on the

undefined reference to SkipNode

c++

I try to implement a skiplist and run into this error