How do I correctly extend the django admin/base.html template? -
this seems should simple must doing wrong. i've extended admin templates individual apps before, first time i've tried extending modify across board.
i want change color of text across entire admin, want extend extrastyle block of base.html template.
so in main templates folder created admin/base.html code in it:
{% extends 'admin/base.html' %} {% block extrastyle %} {# changing color of text across entire admin #} <style> .help, p.help { font-size: 10px !important; color: #f00; } </style> {% endblock %}
now, when try , access admin, server crashes 'bus 10' error. believe because trying extend itself. since django looks first in app template folders, {% extend 'admin/base.html' %} finds first , world explodes.
however, if try placing base html anywhere else doesn't work. if place in 1 of apps works app, if place anywhere else ignored.
from understanding it's best practice extend instead of override django templates, working. if way can overriding it, that's route i'll take.
indeed, problem infinite recursion loop base.html extends itself.
to achieve want should override admin/base_site.html instead (which in turn extends base.html). way can replace blocks you're interested in.
Comments
Post a Comment