Django How can I change the table name used by ie django.contrib.sessions?

How can I change the information in the meta class, that is, "django.contrib.sessions.models", so that my project can have several identical table names, but so that the functionality of the application is the same?

thank

+3
source share
1 answer

You can try the following:

from django.contrib.sessions.models import Session
Session.Meta.db_table = 'my_session'

EDITED The above solution causes an error, but the following works:

from django.contrib.sessions.models import Session
Session._meta.db_table = "my_session"
+4
source

All Articles