#37029 closed Bug (fixed)
{% block pagination %}'s {% endblock %} misplaced in change_list.html
| Reported by: | Oganes Gambaryan | Owned by: | Tim Graham |
|---|---|---|---|
| Component: | contrib.admin | Version: | 6.0 |
| Severity: | Release blocker | Keywords: | |
| Cc: | MANAS MADESHIYA | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | yes |
Description
contrib/admin/templates/admin/change_list.html:
- The layout is fine without overriding the
paginationblock. - The layout will be broken if
paginationblock is overridden by child templates.
The fix below:
diff --git a/django/contrib/admin/templates/admin/change_list.html b/django/contrib/admin/templates/admin/change_list.html
index 78eef88294..3b1aa04615 100644
--- a/django/contrib/admin/templates/admin/change_list.html
+++ b/django/contrib/admin/templates/admin/change_list.html
@@ -92,8 +92,8 @@
<div class="changelist-footer">
{% pagination cl %}
{% if cl.formset and cl.result_count %}<input type="submit" name="_save" class="default" value="{% translate 'Save' %}">{% endif %}
- {% endblock %}
</div>
+ {% endblock %}
</form>
</div>
</div>
Change History (11)
comment:1 by , 3 weeks ago
| Cc: | added |
|---|
comment:2 by , 3 weeks ago
comment:3 by , 3 weeks ago
| Summary: | change_list.html: Broken markup inside {% block pagination %} → {% block pagination %}'s {% endblock %} misplaced in change_list.html |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:4 by , 3 weeks ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:5 by , 3 weeks ago
| Has patch: | set |
|---|
I have submitted a PR for this ticket:
PR: https://github.com/django/django/pull/21090
Changes:
- Corrected the placement of
{% endblock %}inchange_list.html - Ensured proper block structure by moving it outside the
changelist-footerdiv - No functional changes; improves template correctness and readability
comment:6 by , 3 weeks ago
| Owner: | changed from to |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
The original PR stalled because the reporter couldn't understand indentation. I suggest not to use AI in the future because it seems to have trouble with things like that.
I submitted my own trivial PR. I didn't feel a test was useful because if we added a test for the placement of every HTML tag in every template, that would be very onerous.
comment:7 by , 3 weeks ago
| Triage Stage: | Ready for checkin → Accepted |
|---|---|
| Version: | dev → 6.0 |
Refs #36366, regression in 3f59711581bd22ebd0f13fb040b15b69c0eee21f
I didn't feel a test was useful because if we added a test for the placement of every HTML tag in every template, that would be very onerous.
I agree. Could you add a small release note as I believe the regression was introduced in 6.0
comment:8 by , 3 weeks ago
| Severity: | Normal → Release blocker |
|---|
comment:9 by , 3 weeks ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Done. (I call it a bug rather than a regression since <div class="changelist-footer"> is new.)
Hi, I’d like to work on this issue. I’ve started exploring the change_list.html file and will submit a patch soon.