Reputation: 8742
I am trying to change the base_site.html to have my own branding on my admin site. However, I can't get it to work. I followed this tutorial. Anyway, here are the steps:
Added the DIRS settings to settings.py
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',
# `allauth` needs this from django
'django.template.context_processors.request',
],
},
},
]
Made a folder called admin in myapp/templates/ and copied the base_site.html and pasted it there. Next, I edited myapp/templates/admin/base_site.html to look like this:
{% extends "admin/base.html" %}
{% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('MYBRAND Administration') }}</a></h1>
{% endblock %}
{% block nav-global %}{% endblock %}
I also copied base.html and pasted it in my admin folder for good measure. Still, it did not work :/
I even made a folder myProject/templates/admin and pasted the 2 html files in it and even then nothing changed.
What am I doing wrong? BTW, I am using Django-1.9.2.
UPDATE:
I even changed the template in django/contrib/admin/templates. I know Im not supposed to do that, but it was just a test. Even then the change did not work. I am honestly stumped :/ Any help is appreciated. Could be a bug in Django btw?
Upvotes: 2
Views: 264
Reputation: 1559
You need replace all text in the template base_site.html:
From:
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('MYBRAND Administration') }}</a></h1>
{% endblock %}
To:
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">Your Site Name Here</a></h1>
{% endblock %}
if you dont see the name with this recomendation, you need to try clear the cache bowser or restart your enviroment
--
Look this:
Upvotes: 1