Search code examples
djangodjango-modelsdjango-admindjango-apps

proper naming convention in Django


I am using Django 1.11 and on that I have created an app country and inside country/models.py I have a model Country.

class Country(models.Model):
    name = models.CharField(max_length=100)
    code = models.CharField(max_length=50)
    pub_date = models.DateTimeField('date published')

and included the model in admin.py

from django.contrib import admin
from country.models import Country

# Register your models here.
admin.site.register(Country)

When I visited http://127.0.0.1:8000/admin, it shows admin template

The spelling of country has been pluralized to Countrys which is wrong.

What is proper naming convention to prevent such mistakes?


Solution

  • It is not the spelling mistake , It's django convention to show that there will be many records and to show that it adds an s at last after the Model Name.