Opened 7 months ago
Last modified 7 months ago
#36331 closed Bug
Object tools moved out of content block — at Version 1
| Reported by: | Fabian Braun | Owned by: | |
|---|---|---|---|
| Component: | contrib.admin | Version: | 5.2 |
| Severity: | Release blocker | Keywords: | |
| Cc: | Antoliny | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
In Django 5.2 the admin's object-tools block has been moved outside of the content block in django/contrib/admin/templates/admin/base.html as part of https://github.com/django/django/pull/19032 fixing a layout issue.
Before Django 5.2:
...
{% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
{% block content_subtitle %}{% if subtitle %}<h2>{{ subtitle }}</h2>{% endif %}{% endblock %}
{% block content %}
{% block object-tools %}{% endblock %}
{{ content }}
{% endblock %}
...
Since Django 5.2:
...
{% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
{% block object-tools %}{% endblock %}
{% block content_subtitle %}{% if subtitle %}<h2>{{ subtitle }}</h2>{% endif %}{% endblock %}
{% block content %}
{{ content }}
{% endblock %}
...
This is a breaking change in commit abe925ff0bec2db8cd6247397327889d5f1a7f7c:
- Templates that overwrite the
contentblock and contain anobject-toolsblock will have the object tools rendered twice (for example: django-filer) - Templates that overwrite the
contentblock and do not contain anobject-toolsblock will have the default object-tools block rendered instead of none. This can lead to exceptions and server errors 500.
The change is not documented, nor am I aware that it is intended.
Note:
See TracTickets
for help on using tickets.