How can I remove the extra "s" from the django admin panel?

I'm really very annoyed by the extra "s" added after my class name in django admin, for example, the "About" class in my .py model becomes the "Waiters" in the admin section. And I want him not to add extra 's'. Here is my model.py file -

class About(models.Model): about_desc = models.TextField(max_length=5000) def __unicode__(self): # __str__ on Python 3 return str(self.about_desc) 

Please let me know how django can solve my problem.

+5
source share
2 answers

You can add another class called Meta in your model to specify a plural display name. For example, if the model name is Category , the administrator displays Categorys , but by adding the Meta class, we can change it to Categories .

I changed my code to fix the problem:

 class About(models.Model): about_desc = models.TextField(max_length=5000) def __unicode__(self): # __str__ on Python 3 return str(self.about_desc) class Meta: verbose_name_plural = "about" 

For additional Meta options, see https://docs.djangoproject.com/en/1.8/ref/models/options/

+14
source

Take a look at Model Meta in the django documentation.

Within the model, you can add class Meta , which allows you to use additional parameters for your model that handle things such as unique and plural names.

This can be used as follows (we don't have sheep in English), so verbose_name_plural can be used to override djangos attempts with multiple words:

 class Sheep(model.Model): class Meta: verbose_name_plural = 'Sheep' 
+3
source

All Articles