开发者

Django change the admin page label 'Auth' to 'Authentication'

开发者 https://www.devze.com 2023-02-15 22:41 出处:网络
How can i change the display label Auth in the Django admin dashboard to开发者_开发百科 Authentication?There is currently no easy/elegant way to do this. Customisable app-labelling has been a sore poi

How can i change the display label Auth in the Django admin dashboard to开发者_开发百科 Authentication?


There is currently no easy/elegant way to do this. Customisable app-labelling has been a sore point for some time. You can override admin/index.html and inject some javascript code to change the labelling. Note that you could also change admin.site.index_template to something like "admin/my_index.html", which can then use {% extends "admin/index.html" %} to keep things DRYer.

Of course there are other areas in the admin that "Auth" will appear also, such in "admin/app_index.html", the breadcrumbs, etc...


I imagine if your overwriting admin/index.html you could hard code the logic in the template instead of any javascript:

<caption><a href="{{ app.app_url }}" class="section">
        {% ifequal app.name "Auth" %}
                {% trans 'Authentication' %}
        {% else %}
                {% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}
        {% endifequal %}
</a></caption>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号