Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#15206 closed Cleanup/optimization (fixed)

Group: use select_related for permissions on admin change_form

Reported by: Chris Adams Owned by: Chris Adams
Component: contrib.auth Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

django.contrib.auth uses select_related on the User permissions manytomany widget but does not on Group, causing O(n) queries when generating the page.

Attachments (2)

django-15206.patch (1.3 KB) - added by Chris Adams 6 years ago.
django-15206-1.3.patch (3.7 KB) - added by Chris Adams 6 years ago.

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by Chris Adams

Attachment: django-15206.patch added

comment:1 Changed 6 years ago by Chris Adams

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Status: newassigned

comment:2 Changed 6 years ago by Russell Keith-Magee

Needs tests: set
Triage Stage: UnreviewedAccepted

This can be tested using assertNumQueries in a test within the admin_views regression tests.

comment:3 Changed 6 years ago by Chris Adams

milestone: 1.3
Needs tests: unset
Version: 1.2SVN

Updated against trunk with assertNumQueries regression tests for both group and user permissions:

https://github.com/acdha/django/compare/master...bug-15206-1.3

Changed 6 years ago by Chris Adams

Attachment: django-15206-1.3.patch added

comment:4 Changed 6 years ago by Łukasz Rekucki

Severity: Normal
Type: Cleanup/optimization

comment:5 Changed 5 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

In [16620]:

Fixed #15206 -- Added select_related call to the permissions field of the GroupAdmin to lower the number of queries. Thanks, Chris Adams.

comment:6 Changed 5 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top