[Django] #28220: contrib.auth.models Group should have a default ordering to prevent UnorderedObjectListWarning

9 views
Skip to first unread message

Django

unread,
May 17, 2017, 6:29:51 PM5/17/17
to django-...@googlegroups.com
#28220: contrib.auth.models Group should have a default ordering to prevent
UnorderedObjectListWarning
------------------------------------------+------------------------
Reporter: Denise Mauldin | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
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 |
------------------------------------------+------------------------
Since contrib.auth.models Group doesn't have an ordering default, any
selection using Group and filter causes an UnorderedObjectListWarning in
Django 1.11.

`Group.objects.filter(user=user.id)`

Can a default ordering be set somehow to prevent this warning?

Thanks,
Denise

--
Ticket URL: <https://code.djangoproject.com/ticket/28220>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 17, 2017, 9:37:25 PM5/17/17
to django-...@googlegroups.com
#28220: contrib.auth.models Group should have a default ordering to prevent
UnorderedObjectListWarning
--------------------------------+--------------------------------------

Reporter: Denise Mauldin | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------

Comment (by Simon Charette):

Defining a default ordering coud break existing application and would most
likely require a migration for the `_meta.ordering` change.

The only paginated use of `Group`'s manager is through `GroupAdmin` which
is
[https://github.com/django/django/blob/650bf6714d5648811a8bc08ce53b7fa86cc38d40/django/contrib/auth/admin.py#L29
already ordered] by `name`.

Is there a reason you can't explicitly specify an ordering when exposing
groups through a paginated view by using `order_by()`?

--
Ticket URL: <https://code.djangoproject.com/ticket/28220#comment:1>

Django

unread,
May 18, 2017, 10:49:36 AM5/18/17
to django-...@googlegroups.com
#28220: contrib.auth.models Group should have a default ordering to prevent
UnorderedObjectListWarning
-------------------------------------+-------------------------------------

Reporter: Denise Mauldin | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* component: Uncategorized => contrib.auth
* resolution: => wontfix
* type: Uncategorized => Cleanup/optimization


--
Ticket URL: <https://code.djangoproject.com/ticket/28220#comment:2>

Django

unread,
May 18, 2017, 2:07:02 PM5/18/17
to django-...@googlegroups.com
#28220: contrib.auth.models Group should have a default ordering to prevent
UnorderedObjectListWarning
-------------------------------------+-------------------------------------

Reporter: Denise Mauldin | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Denise Mauldin):

Will do. Just was hoping there was a faster way than updating all of our
code. Thanks.

Replying to [comment:1 Simon Charette]:


> Defining a default ordering coud break existing application and would
most likely require a migration for the `_meta.ordering` change.
>
> The only paginated use of `Group`'s manager is through `GroupAdmin`
which is
[https://github.com/django/django/blob/650bf6714d5648811a8bc08ce53b7fa86cc38d40/django/contrib/auth/admin.py#L29
already ordered] by `name`.
>
> Is there a reason you can't explicitly specify an ordering when exposing
groups through a paginated view by using `order_by()`?

--
Ticket URL: <https://code.djangoproject.com/ticket/28220#comment:3>

Reply all
Reply to author
Forward
0 new messages