Django fix Admin plural

ID : 20269

viewed : 21

Tags : djangodjango-admindjango

Top 5 Answer for Django fix Admin plural

vote vote


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 file. Here is the location in the dev docs where it is described:

vote vote


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

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


vote vote


vote vote


I know this is an older thread but I wanted to give what I think to be helpful information.

I personally use PyPy which is really easy to install using pip. I interchangeably use Python/PyPy interpreter, you don't need to change your code at all and I've found it to be roughly 40x faster than the standard python interpreter (Either Python 2x or 3x). I use pyCharm Community Edition to manage my code and I love it.

I like writing code in python as I think it lets you focus more on the task than the language, which is a huge plus for me. And if you need it to be even faster, you can always compile to a binary for Windows, Linux, or Mac (not straight forward but possible with other tools). From my experience, I get about 3.5x speedup over PyPy when compiling, meaning 140x faster than python. PyPy is available for Python 3x and 2x code and again if you use an IDE like PyCharm you can interchange between say PyPy, Cython, and Python very easily (takes a little of initial learning and setup though).

Some people may argue with me on this one, but I find PyPy to be faster than Cython. But they're both great choices though.

Edit: I'd like to make another quick note about compiling: when you compile, the resulting binary is much bigger than your python script as it builds all dependencies into it, etc. But then you get a few distinct benefits: speed!, now the app will work on any machine (depending on which OS you compiled for, if not all. lol) without Python or libraries, it also obfuscates your code and is technically 'production' ready (to a degree). Some compilers also generate C code, which I haven't really looked at or seen if it's useful or just gibberish. Good luck.

Hope that helps.

Top 3 video Explaining Django fix Admin plural