Opened 5 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: acdha Owned by: acdha
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:


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

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by acdha

comment:1 Changed 5 years ago by acdha

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 5 years ago by russellm

  • Needs tests set
  • Triage Stage changed from Unreviewed to Accepted

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

comment:3 Changed 5 years ago by acdha

  • milestone set to 1.3
  • Needs tests unset
  • Version changed from 1.2 to SVN

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

Changed 5 years ago by acdha

comment:4 Changed 5 years ago by lrekucki

  • Severity set to Normal
  • Type set to Cleanup/optimization

comment:5 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

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 deleted

Milestone 1.3 deleted

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