3

I'm learning python/Django and setting up my first project. All is going well but I've been searching like crazy on something very simple.

There is a default menu item "Authentication and Authorization" and I want to change the name. I've searched in the template if I need to extend something, I've searched if there's a .po file or what not but I can't find it nor a hint on which parameter I should overwrite in admin.py to set it.

I'm not trying to install multi language or some advanced localization, just want to change the name of that one menu item :)

Any ideas?

Pasha
  • 6,298
  • 2
  • 22
  • 34
Zadder
  • 75
  • 1
  • 6

4 Answers4

4

To follow up on Lorenzo's answer (Django 3.0):

Create a file with your custom AppConfig somewhere in your project

# 'authconfig.py'
from django.apps import AppConfig

class CustomAuthConfig(AppConfig):
    name = 'django.contrib.auth'
    verbose_name = 'my super special auth name'

Then, in settings.py:

INSTALLED_APPS = [
    ...
    #'django.contrib.auth', # comment out to avoid duplicate apps
    'authconfig.CustomAuthConfig', # add this in for custom config of auth module
    ...
]
TKW
  • 317
  • 4
  • 11
1

Create a custom AppConfig pointing to original django.auth module and override verbose_name. Then use your custom AppConfig in INSTALLED_APPS instead of original auth app.

https://docs.djangoproject.com/en/1.10/ref/applications/#configuring-applications

Lorenzo Peña
  • 2,225
  • 19
  • 35
0

This can't be done at least cleanly via templates..

You can put the auth app verbose name "authentication and authorization" in your own .po file (& follow Django docs on translation) This way Django will normally use your name.

Ramez Ashraf
  • 873
  • 6
  • 14
0

If you are using a custom locale (refer to How to override the django admin translation?) then the best way is to add these lines to the django.po file:

msgid "Authentication and Authorization"
msgstr "Your text for the auth app"

For some reason many localization files fail to include a translation for the "Authentication and Authorization" string. Adding it like that (and using the compilemessages command as mentioned in the link above) should work just fine.