pythondjangodjango-models

How can i remove extra "s" from django admin panel?


I am really very much irritated by the extra "s" added after my class name in django admin eg class 'About' in my model.py becomes 'Abouts' in admin section. And i want it 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 anybody suggest me how django can solve my problem.


Solution

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

    I have changed your code to fix the issue:

    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 more Meta options, refer to https://docs.djangoproject.com/en/1.8/ref/models/options/