How to read the database table name of a Model instance?

Django

Django Problem Overview


Given a model's instance object, how can I get the database table's name?

I don't want to specify names explicitly in the Meta class.

Django Solutions


Solution 1 - Django

Found the answer myself: the _meta attribute of an instance has the information:

model_instance._meta.db_table

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBerView Question on Stackoverflow
Solution 1 - DjangoBerView Answer on Stackoverflow