#31187: ChangeList._get_deterministic_ordering() should inspect UniqueConstraint
---------------------------------------------+------------------------
               Reporter:  Fabio Sangiovanni  |          Owner:  nobody
                   Type:  New feature        |         Status:  new
              Component:  contrib.admin      |        Version:  master
               Severity:  Normal             |       Keywords:
           Triage Stage:  Unreviewed         |      Has patch:  0
    Needs documentation:  0                  |    Needs tests:  0
Patch needs improvement:  0                  |  Easy pickings:  0
                  UI/UX:  0                  |
---------------------------------------------+------------------------
 I've been fiddling with db indexes lately to improve the performance of an
 admin view.
 Eventually I found this PR https://github.com/django/django/pull/10692
 which ensures the records displayed by `ChangeList` are deterministically
 ordered.
 Among other things, the code looks for the presence of a `unique_together`
 attribute on the `Meta` class of the model to determine if the model is
 already totally ordered.

 I think that `_get_deterministic_ordering()` should check for the presence
 of `UniqueConstraints` as well, which currently aren’t considered by the
 discovery algorithm.

 I noticed the docs currently advise against using `unique_together` in
 favor of `UniqueConstraint`, suggesting the former may be deprecated in
 the future, so this fix would change that part of the code accordingly.

 I'm willing to submit a PR for this.

 Cheers,
 Fabio

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31187>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/050.4bf700bcf283e1a277ca765f530c7aea%40djangoproject.com.

Reply via email to