3

I am working with Django 1.8.4 (latest).

I’m stuck with the official Django tutorial steps from: https://docs.djangoproject.com/en/1.8/intro/tutorial02/#customize-the-admin-look-and-feel

I am trying to rename “Django administration" but nothing happens.

I searched for the answer and found the totally same question here: _http://stackoverflow.com/questions/28787823/cant-change-django-admin-template There is now answer.

I did exactly the same as described there and in the tutorial.

As you can see from my repo: https://github.com/legobillyjoe/django-tutorial

the location of my base_site.html is mysite/templates/admin, as suggested in the tutorial.

I have added in settings TEMPLATES = [os.path.join(BASE_DIR, 'templates')], but nothing changes.

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

Any suggestions what I can do in order to make it work?

Adam Jones
  • 43
  • 6

1 Answers1

1

Did you run the makemessages command after you changed the translation strings? Also the default will only appear if the variables return None types

But actually, there's no need to override any templates for your requirement, in your admin file after your import statements add the following:

admin.site.site_header = _(u"Title")
admin.site.index_title = _(u"Subtitle")

So you have something like

from django.contrib import admin
from django.utils.translation import ugettext as _

admin.site.site_header = _(u"Title")
admin.site.index_title = _(u"Subtitle")

class FooAdmin(admin.ModelAdmin):
    etc...
Hedde van der Heide
  • 21,841
  • 13
  • 71
  • 100