Opened 3 weeks ago

Closed 2 weeks ago

Last modified 2 weeks ago

#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 pagination block.
  • The layout will be broken if pagination block 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 MANAS MADESHIYA, 3 weeks ago

Cc: MANAS MADESHIYA added

comment:2 by harshitha1869, 3 weeks ago

Hi, I’d like to work on this issue. I’ve started exploring the change_list.html file and will submit a patch soon.

comment:3 by Tim Graham, 3 weeks ago

Summary: change_list.html: Broken markup inside {% block pagination %}{% block pagination %}'s {% endblock %} misplaced in change_list.html
Triage Stage: UnreviewedAccepted

comment:4 by MANAS MADESHIYA, 3 weeks ago

Owner: set to MANAS MADESHIYA
Status: newassigned

comment:5 by MANAS MADESHIYA, 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 %} in change_list.html
  • Ensured proper block structure by moving it outside the changelist-footer div
  • No functional changes; improves template correctness and readability

comment:6 by Tim Graham, 3 weeks ago

Owner: changed from MANAS MADESHIYA to Tim Graham
Triage Stage: AcceptedReady 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 Sarah Boyce, 3 weeks ago

Triage Stage: Ready for checkinAccepted
Version: dev6.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 Sarah Boyce, 3 weeks ago

Severity: NormalRelease blocker

comment:9 by Tim Graham, 3 weeks ago

Triage Stage: AcceptedReady for checkin

Done. (I call it a bug rather than a regression since <div class="changelist-footer"> is new.)

comment:10 by Sarah Boyce <42296566+sarahboyce@…>, 2 weeks ago

Resolution: fixed
Status: assignedclosed

In 8d326336:

Fixed #37029 -- Corrected placement of </div> in change_list.html's pagination block.

Bug in 3f59711581bd22ebd0f13fb040b15b69c0eee21f.

comment:11 by Sarah Boyce <42296566+sarahboyce@…>, 2 weeks ago

In 69d86004:

[6.0.x] Fixed #37029 -- Corrected placement of </div> in change_list.html's pagination block.

Bug in 3f59711581bd22ebd0f13fb040b15b69c0eee21f.

Backport of 8d326336c5fba4740114fea5294a7b426c96d65c from main.

Note: See TracTickets for help on using tickets.
Back to Top