diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2019-02-13 03:35:49 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2019-02-12 21:36:07 -0500 |
| commit | f2b460231dc15d4d0629b856f31ff9433da07f95 (patch) | |
| tree | bec88dc5ff3c09ade0eced9194bce04cc017b9e0 | |
| parent | c3655b152868176359206a7a759ac38ea5e9c047 (diff) | |
[2.2.x] Fixed #29943 -- Doc'd that admin changelist may add pk to ordering.
Backport of f63811f4813f0e0439e140a97eeba18a5017e858 from master.
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index c163dc9f2e..4ebe565ae8 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -1043,6 +1043,17 @@ subclass:: If you need to specify a dynamic order (for example depending on user or language) you can implement a :meth:`~ModelAdmin.get_ordering` method. + .. admonition:: Performance considerations with ordering and sorting + + To ensure a deterministic ordering of results, the changelist adds + ``pk`` to the ordering if it can't find a single or unique together set + of fields that provide total ordering. + + For example, if the default ordering is by a non-unique ``name`` field, + then the changelist is sorted by ``name`` and ``pk``. This could + perform poorly if you have a lot of rows and don't have an index on + ``name`` and ``pk``. + .. attribute:: ModelAdmin.paginator The paginator class to be used for pagination. By default, |
