Opened 4 years ago

Closed 4 years ago

Last modified 4 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:

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

Download all attachments as: .zip

Change History (8)

Changed 4 years ago by acdha

comment:1 Changed 4 years ago by acdha

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

comment:2 Changed 4 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 4 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:

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

Changed 4 years ago by acdha

comment:4 Changed 4 years ago by lrekucki

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

comment:5 Changed 4 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 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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