3

just started an official Django tutorial and already ran into a problem, can't change page name in admin panel. I'm trying to replace a default Django administration with something custom in the base_site.html as suggested in the tutorial (a file which I copied from the django source directory into my app, tried to move it in/out polls directory etc.),
I have added in settings TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')], and in installed apps also 'polls', but nothing changes.

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

Thanks

ikechi
  • 329
  • 1
  • 9

2 Answers2

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
  • 456
  • 6
  • 18
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.

Mazvél
  • 951
  • 1
  • 8
  • 22
  • 2
    I have exactly the same settings/project hierarchy. Still didn't work. – ikechi Mar 01 '15 at 00:02
  • @ikechi and you are sure that you saved the edits to the base_site.html? – Mazvél Mar 01 '15 at 00:20
  • @ikechi and your settings file also hase the variable BASE_DIR correctly set up? You might want to check the top answer from [this question](http://stackoverflow.com/questions/15411164/django-templates-folders) – Mazvél Mar 01 '15 at 00:37
  • 1
    changing to `abspath` doesn't help. I really don't know what is the problem. – ikechi Mar 01 '15 at 01:32