[Python] How to remove automatically added post-fix 's' from database table name in Django...

Discussão em 'Python' iniciado por Stack, Julho 15, 2025.

  1. Stack

    Stack Membro Participativo

    Can anyone tell me how to get rid of the postfix 's' from the db_table name? Below is the sample model code. When I see this model in the admin portal, I see the database table name is 'countrys'. How can I remove this 's' from my db_table name?

    class Country(models.Model):
    name = models.CharField(max_length=30)
    population = models.IntegerField()
    alpha2Code = models.CharField(max_length=2, primary_key=True)
    languages = models.CharField(max_length=256)

    class Meta:
    db_table = "country"


    Thanks in advance

    Continue reading...

Compartilhe esta Página