Django; How can i change the table name used by i.e django.contrib.sessions?

前端 未结 1 968
北恋
北恋 2020-12-19 14:32

How can i change the info in the Meta class in i.e \'django.contrib.sessions.models\' , so that my project can have somewhat uniform table names, but so that the functionali

相关标签:
1条回答
  • 2020-12-19 15:24

    You can try this:

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

    EDITED The above solution throws an error but the following works:

    from django.contrib.sessions.models import Session
    Session._meta.db_table = "my_session"
    
    0 讨论(0)
提交回复
热议问题