Search code examples
djangoadmindjango-grappelli

Django admin dashboard, is there a way to lowercase model name?


I'm looking for a way to lowercase the first letter of a model in my django admin site.

i.e.: model verbose name is "agent-1.0.0" is shown as "Agent-1.0.0" on the dashboard,

simple but IDK

grappelli trick will also work for me.

django - 1.7.1

also - need this only for one app models group - not all of my dashboard should be lowercase... so, overriding the index.html is not so efficient


Solution

  • The capitalization is hard-coded in the template, same for the templates in Grappelli.

    You can use catavaran's suggestion, but this will transform every model name. Overriding the template is a huge pain in the ass to maintain for something this small.

    The only workable solution I can think of is to bypass the capfirst filter with a space:

    class Meta:
        verbose_name = " agent-1.0.0"
    

    As capfirst only forcibly capitalizes the first character, nothing will happen if the first character is not a letter.