Django change the admin page label 'Auth' to 'Authentication'
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>
精彩评论