Django fix Admin plural

DjangoDjango Admin

Django Problem Overview


How do I change some models name from "Categorys" to "Categories" on admin site in the new dev django version? In the old version (whithout admin sites and admin models) you could just do this; http://www.the-dig.com/blog/post/customize-plural-name-django-admin/

However - now setting verbose_name_plural inside my modeladmin based class does nothing. Anyone encouter the same issue?

Django Solutions


Solution 1 - Django

Well well, it seems like the Meta class approach still works. So placing a meta class inside your model will still do the trick:

class Category(models.Model):
    class Meta:
        verbose_name_plural = "categories"

Note that we use the lower case here, as django is smart enough to capitalize it when we need it.

I find setting this option in model-class weird as opposed to the admin.py file. Here is the location in the dev docs where it is described:
http://docs.djangoproject.com/en/dev/ref/models/options/#verbose-name-plural

Solution 2 - Django

for that you need to add meta classes for models

class Category(models.Model):
    --- model field here ---
    class Meta: 
        verbose_name = "Category"
        verbose_name_plural = "Categories"

Bonus for your models admin in apps.py

class CategoryConfig(AppConfig):
    name = "Category"
    verbose_name = "Categories"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndriy DrozdyukView Question on Stackoverflow
Solution 1 - DjangoAndriy DrozdyukView Answer on Stackoverflow
Solution 2 - DjangoSaurabh Chandra PatelView Answer on Stackoverflow