[Fixed]-Django 1.7 – updating base_site.html not working


To start off, I am not sure if it was a copy/paste issue or if you actually have TEMPLATE_DIRS commented out. It will need to be a non-commented line:

TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

As for the real problem, you have to replace more of your template to make it work because site_title is defined here: https://github.com/django/django/blob/1.7/django/contrib/admin/sites.py#L36
and site_header is defined here: https://github.com/django/django/blob/1.7/django/contrib/admin/sites.py#L39

Default will only work if these do not exist, so your template should look like this:

{% extends "admin/base.html" %}

{% block title %}{{ title }} | whatever site admin{% endblock %}

{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">whatever site administration</a></h1>
{% endblock %}

{% block nav-global %}{% endblock %}

You can learn more about the default tag here: https://docs.djangoproject.com/en/1.7/ref/templates/builtins/#default


Leave a comment