Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#12340 closed (fixed)

`BaseGenericInlineFormSet.get_queryset` returns an unordered queryset

Reported by: jbronn Owned by: jbronn
Component: Contrib apps Version: master
Severity: Keywords: generic inline
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: UI/UX:

Description

The parent class, BaseModelFormSet, [source:django/trunk/django/forms/models.py@11688#L481 orders the queryset it returns], and so should BaseGenericInline. An important reason to do this is that BaseFormSet._construct_form uses [source:django/trunk/django/forms/models.py@11688#L478 queryset slicing] at an integer index, and if the QuerySet returned is unordered, then it's possible to get the same model for a different integer index.

Attachments (1)

generic_inline_order_qs_v1.diff (882 bytes) - added by jbronn 5 years ago.
Orders the queryset.

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by jbronn

Orders the queryset.

comment:1 Changed 5 years ago by jbronn

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

(In [11800]) Fixed #12340 -- BaseGenericInlineFormSet.get_queryset now returns an ordered queryset.

comment:2 Changed 5 years ago by jbronn

(In [11801]) [1.1.X] Fixed #12340 -- BaseGenericInlineFormSet.get_queryset now returns an ordered queryset.

Backport of r11800 from trunk.

comment:3 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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