Dhanushka Amarakoon
Dhanushka Amarakoon

Reputation: 3762

Changing default table names in Django

Django follows the standard applicationName_ModelName for its tables. How can I change it so that it creates a table name that I want ?

Upvotes: 2

Views: 1973

Answers (1)

Penguin Brian
Penguin Brian

Reputation: 2141

You need to set the db_table meta option. See the documentation. For example:

class MyModel(models.Model):

    class Meta:
        db_table = "mytable_name"

Upvotes: 3

Related Questions