Issue
I extended django admin site according to Customize Django admin template and official doc
{% extends 'admin/base_site.html' %}
{% load static %}
{% block branding %}
<div class="head">
<h1 id="name">Admin Dashboard abc</h1>
</div>
{% endblock %}
{% block content %}
<h2>Custom Content</h2>
{% endblock %}
{% block nav-global %}
<img class="brand_img" src="{% static 'images/ic_launcher.png'%}" width="50" height="50" alt="logo logo">
{% endblock %}
"block branding" & "block nav-global" is displaying correctly but "block content" is not making any change to admin site. The official doc says..
If you want to use the admin layout, extend from admin/base_site.html:
{% extends "admin/base_site.html" %} {% block content %} ... {% endblock %}
And I did what the doc says but is not working. What am I doing wrong?
Solution
{% block content %}
is populated by index.html
which extends base_site.html
therefore even if you do any changes in base_site.html
it will be overriden by index.html
's {% block content %}
. The possible solution is to delete everything in index.html
's block content and call {{block.super}}
so if you do any changes in base_site.html
they will be passed to index.html
.
Answered By - rollingthedice
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.