Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#14312 closed (fixed)

list_editable causes 500s for ?p>maximum

Reported by: Tuttle Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: sprintnov13
Cc: t.django@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When there is list_editable defined in ModelAdmin && there is pagination active (there exist more than one page of objects) && user requests page beyond the last one, exception is raised:

AttributeError: 'tuple' object has no attribute 'ordered'

Full traceback attached.

Presumably the reason is: The cl.result_list is an empty tuple since the InvalidPage exception handler in ChangeList.get_results, but it's expected to be a queryset by a FormSet constructor (options.py:1057).

Attachments (3)

AttributeError_for_list_editable.html (106.8 KB) - added by Tuttle 5 years ago.
full HTML debugging traceback
fix14312-1.patch (2.0 KB) - added by mk 5 years ago.
fix14312-2.patch (2.2 KB) - added by mk 5 years ago.

Download all attachments as: .zip

Change History (9)

Changed 5 years ago by Tuttle

full HTML debugging traceback

comment:1 Changed 5 years ago by mk

  • Has patch set
  • milestone set to 1.3
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

I see two possible approaches to fix this problem:

  1. Return an EmptyQuerySet instead of a tuple. The changelist still shows up, but is empty (at least it does not crash).
  1. Raise an IncorrectLookupParameters exception, all GET parameters are reset.

Assigning milestone 1.3, because this is a reproducible bug which always crashes with a 500 Internal Server Error.

Changed 5 years ago by mk

Changed 5 years ago by mk

comment:2 Changed 5 years ago by gregmuellegger

  • Triage Stage changed from Accepted to Ready for checkin

Looks good to me. Seems to be ready for checkin.

comment:3 Changed 5 years ago by steph

  • Keywords sprintnov13 added

comment:4 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

(In [14889]) Fixed #14312 -- Raising an IncorrectLookupParameters if the page number given to an admin change list exceeds the number of the last page. Thanks, mk.

comment:5 Changed 5 years ago by jezdez

(In [14908]) [1.2.X] Fixed #14312 -- Raising an IncorrectLookupParameters if the page number given to an admin change list exceeds the number of the last page. Thanks, mk.

Backport from trunk (r14889).

comment:6 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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