pythondjangodjango-modelsgrammar

Django DB table names, plural double s


In Rails when creating DB tables from the models, Product becomes Products, Status becomes Statuses etc. Django does not fully seem to have that inbuilt grammar functionality. Product becomes Products, but Status becomes Statuss.

Is there a way to fix this?


Solution

  • Yes, there's an attributes you can add to a models class Meta, verbose_name_plural -

    class YourModel(Model):
        # fields
        class Meta:
            verbose_name_plural = 'Statuses'
    

    See the docs.