Vivek
Vivek

Reputation: 102

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 ?

Upvotes: 0

Views: 79

Answers (1)

Nicolas Appriou
Nicolas Appriou

Reputation: 2331

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

MyModel._meta.db_table

Upvotes: 3

Related Questions