[Django]-Django always capitalizes a model's verbose name in admin index page

0👍

It’s not that easy…

  • Make a copy of the admin/index.html template to your
    template/admin/index.html
  • Create your own template filter: lowerfirst_if_starts_with_v in your
    own templatetags/my_special_thing.py directory
@register.filter(is_safe=True)
@stringfilter
def lowerfirst_if_starts_with_v(value):
    """Lowercase the first character of the value."""
    return value and value[0] =='v' and value[0].lower() + value[1:]
  • Load it in the index.html
{%load my_special_thing%}
  • Apply it to index.html on line 23
<th scope="row"><a href="{{ model.admin_url }}"> \
{{ model.name|lowerfirst_if_starts_with_v }}</a></th>

And done.

Leave a comment