简体   繁体   中英

Show the table name in database regarding the model in django

I have to find the database table name of resoective model in my project, how can i do it . I previously tried the


 class Meta:
        db_table = 'tablenameIWant'

but how can I see the table name ?

The Meta class of models can be accessed with the _meta attribute. So:

MyModel._meta.db_table

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM