#28220 closed Cleanup/optimization (wontfix)
contrib.auth.models Group should have a default ordering to prevent UnorderedObjectListWarning
Reported by: | Denise Mauldin | Owned by: | nobody |
---|---|---|---|
Component: | contrib.auth | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
Change History (3)
follow-up: 3 comment:1 by , 7 years ago
comment:2 by , 7 years ago
Component: | Uncategorized → contrib.auth |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Type: | Uncategorized → Cleanup/optimization |
comment:3 by , 7 years ago
Will do. Just was hoping there was a faster way than updating all of our code. Thanks.
Replying to 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 throughGroupAdmin
which is already ordered byname
.
Is there a reason you can't explicitly specify an ordering when exposing groups through a paginated view by using
order_by()
?
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 throughGroupAdmin
which is already ordered byname
.Is there a reason you can't explicitly specify an ordering when exposing groups through a paginated view by using
order_by()
?