[Django]-Can't change Django admin template

5👍

It will not work if you only change the value inside the parentheses like this

{{ site_header|default:_('Your custom name') }}

What you need to do is you must replace all of the above with your desired name like this.

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

{% block title %}{{ title }} | YOUR CUSTOM NAME{% endblock %}

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

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

1👍

I created a templates folder at the root level of my Django Site.

base-folder 
--apps
--templates 
----admin 
------base_site.html

I edited base_site.html like I wanted, I just changed the name like you are trying to. Then I added this line into my settings.py

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

This worked for me. If you are seeing the admin site when you type /admin that means your url-config is set. Just make sure that your TEMPLATE_DIRS matches the directory of the admin template. You should have admin directory within the templates directory that contains all the necessary templates for the admin page.

Leave a comment