Reputation: 25
I am using Python 3.10.0 and Django 3.2.9
I created a new app in my django project, and then created a model called Posts. Everything works as intended except for how it's name is being displayed in the admin section of the website. It says "Postss" (double s in the end). If I change the model name to "Post" or just one letter "P" for instance, django automatically adds "s" to the end of it's name, so it is being displayed as "Posts" or "Ps" then.
Other words, whatever the model name is, django automatically adds "s" in the end of it's name in the admin pannel of the website.
Is it possible to tell django I don't want that "s" to be added? How?
Thanks a mil, guys.
Upvotes: 1
Views: 123
Reputation: 477794
Normally models have singular names, so Post
, not . You thus might want to consider renaming your model.Posts
If you still want to use Posts
as model name, you can specify the verbose name of the model, and the plural verbose name with the verbose_name
[Django-doc] and the verbose_name_plural
model options [Django-doc] respectively:
class Posts(models.Model):
# …
class Meta:
verbose_name = 'post'
verbose_name_plural = 'posts'
But as said before, if you rename your model Post
, Django will convert the PerlCase to a name with spaces and as plural append the name with an s
.
Upvotes: 1