简体   繁体   English

显示数据库中关于django模型的表名

[英]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.可以使用_meta属性访问模型的 Meta 类。 So:所以:

MyModel._meta.db_table

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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