I would like to rename the default table comes from Django. Meta does copy the table but the columns are totally difference How can i over come with it?
The reason this happens is because Session
is a concrete model. What here happens is that you specify you want to inherit the Session
table. This is implemented in the SQL layer by making a new table that contains, besides the extra fields, a OneToOneField
to the parent table, and furthermore this acts as a primary key as well. For more information on how Django handles model inheritance, see the section on Multi-table inheritance in the documentation.
If you want to implement your own session model, you should inherit from the AbstractBaseSession
model [Django-doc]. This is an abstract model that has as fields sesion_key
, session_data
and expire_date
. You can then override or "monkey patch" the get_model_class
of the SessionStore
.