5๐
Why is django-admin adding an โsโ
There is a naming convention in Django the models are named in the singular. So your classes should be named:
class Comment(models.Model):
...
class Note(models.Model):
...
An instance of such a class represents a single comment, not a set of comments. Likewise consider the following
# doesn't really make sense
Comments.objects.get(...)
# reads much better
Comment.objects.get(...) #e.g. get from the comment objects
This is so much of a convention that Django admin expects for your classes to be named in the singular. For this reason, Django adds on an โsโ as a standard way of pluralising your class names. (This will admittedly not work for all words and is very anglo-centric, but as an override, Django provides the verbose_name_plural
meta-attribute).
How to fix it:
Rename your classes so they are in the singular. This will make your code a lot more readable to anyone who is used to reading django. It will also make your models named in a way consistent with other third-party packages. If your class names are not in English, or do not pluralise simply by appending an s, use verbose_name_plural
e.g:
Class Cactus(models.Model):
class Meta:
verbose_name_plural = 'Cacti'
6๐
Add a meta class to your model and set verbose_name_plural
(https://docs.djangoproject.com/en/3.2/ref/models/options/#verbose-name-plural). Ideally name your classes as singular (in this case youโd have class Comment(models.Model)
.
class Comments(models.Model):
class Meta:
verbose_name_plural = 'Comments'
- [Django]-How to add a new field in django model
- [Django]-Django model.save() not writing to database