﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31187	Detection of existing total ordering in admin changelist should take into account UniqueConstraints without conditions.	Fabio Sangiovanni	Fabio Sangiovanni	"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"	Bug	closed	contrib.admin	dev	Normal	fixed			Accepted	1	0	0	0	0	0
