#37004: BaseModelFormSet could leverage totally_ordered property
-------------------------------------+-------------------------------------
               Reporter:  Jacob      |          Owner:  Sarah Boyce
  Walls                              |
                   Type:             |         Status:  assigned
  Cleanup/optimization               |
              Component:  Forms      |        Version:  dev
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 #36857 added a new property `totally_ordered` on `QuerySet` to capture the
 difference between a queryset having ''some'' ordering versus a "stable,
 deterministic" ordering.

 I noticed that we probably want to use that new property here in
 `BaseModelFormSet` for the purpose described in #10163:

 {{{#!diff
 diff --git a/django/forms/models.py b/django/forms/models.py
 index 104369c0b0..3843203a1d 100644
 --- a/django/forms/models.py
 +++ b/django/forms/models.py
 @@ -776,7 +776,7 @@ class BaseModelFormSet(BaseFormSet, AltersData):
              # If the queryset isn't already ordered we need to add an
              # artificial ordering here to make sure that all formsets
              # constructed from this queryset have the same form order.
 -            if not qs.ordered:
 +            if not qs.totally_ordered:
                  qs = qs.order_by(self.model._meta.pk.name)

              # Removed queryset limiting here. As per discussion re:
 #13023
 }}}

 Tentatively assigning to Sarah to see if a good fit for any Djangonauts
 this session. This would involve cooking up a test.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/37004>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d21903a39-8fd199c1-2f97-4d9d-b4c6-a1ae982043bf-000000%40eu-central-1.amazonses.com.

Reply via email to