Opened 13 years ago

Closed 13 years ago

Last modified 12 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: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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 13 years ago.
django-15206-1.3.patch (3.7 KB ) - added by Chris Adams 13 years ago.

Download all attachments as: .zip

Change History (8)

by Chris Adams, 13 years ago

Attachment: django-15206.patch added

comment:1 by Chris Adams, 13 years ago

Status: newassigned

comment:2 by Russell Keith-Magee, 13 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

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

comment:3 by Chris Adams, 13 years ago

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

by Chris Adams, 13 years ago

Attachment: django-15206-1.3.patch added

comment:4 by Łukasz Rekucki, 13 years ago

Severity: Normal
Type: Cleanup/optimization

comment:5 by Jannis Leidel, 13 years ago

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 by Jacob, 12 years ago

milestone: 1.3

Milestone 1.3 deleted

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