I am using Django1.9 & trying to override admin interface.
I referred following link to override admin header
http://stackoverflow.com/questions/4938491/django-admin-change-header-django-administration-text
As mentioned in post, my directory/file structure is src->templates->admin->base_site.html
base_site.html
{% extends "admin/base.html" %}
{% block title %}Personal Site{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">Control Panel</a></h1>
{% endblock %}
{% block nav-global %}{% endblock %}
But this page is not getting called. I copied base_site.html code from https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/base_site.html
& made changes in title.
I know, I can configure admin header in django, but this is not I am looking for. My long-term goal is to configure entire admin UI. So please explain me how I can make this custom template page get called.
Here is my template settings :
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR,'templates'),
],
'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',
],
'loaders':[
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader'
]
},
},
]
Thanks Aniruddha
configure project's admin template directories at the contrib/admin/templates/admin
directory.
For override -Create a customadmin directory in templates directory.
django.template.loaders.filesystem.Loader
' (must be written before )django.template.loaders.app_directories.Loader
'.This will load the custom templates before default.
Create directories in customadmin and name these as of app, if you want to override for app.
In above subdirectories, create directories for models and name them as model, for overriding the model.
Create your custom extended template (the html file in most cases) in desired directory.
Congratulations. You have extended the default provided admin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With