Code

Opened 4 years ago

Closed 4 years ago

#13118 closed (duplicate)

Multiple(minimum 36) queries when opening user page in django admin

Reported by: DesZodiak Owned by: nobody
Component: contrib.admin Version: 1.1
Severity: Keywords: django admin multiple queries
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When i am trying to edit user in django admin, admin app makes a lot of queries (see below). The difference between them just in id of element.
This queries makes while ModelAdmin form renders.
Everything below i took from django-debug-toolbar.

Here is duplicate query:

SELECT "auth_permission"."id", "auth_permission"."name",
"auth_permission"."content_type_id", "auth_permission"."codename" FROM
"auth_permission" INNER JOIN "django_content_type" ON
("auth_permission"."content_type_id" = "django_content_type"."id")
ORDER BY "django_content_type"."app_label" ASC,
"auth_permission"."codename" ASC

Here is execution stack

LineMethodFile
226wrapper/home/alex/Develop/Django/test/env/lib/python2.6/site-packages/django/contrib/admin/options.py
186inner/home/alex/Develop/Django/test/env/lib/python2.6/site-packages/django/contrib/admin/sites.py
873change_view/home/alex/Develop/Django/test/env/lib/python2.6/site-packages/django/contrib/admin/options.py
590render_change_form/home/alex/Develop/Django/test/env/lib/python2.6/site-packages/django/contrib/admin/options.py
231render/home/alex/Develop/Django/test/env/lib/python2.6/site-packages/django/contrib/admin/widgets.py
36render/home/alex/Develop/Django/test/env/lib/python2.6/site-packages/django/contrib/admin/widgets.py

And part from template

9{% if field.is_checkbox %}
10{{ field.field }}{{ field.label_tag }}
11{% else %}
12{{ field.label_tag }}{{ field.field }}
13{% endif %}
14{% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text|safe }}</p>{% endif %}
15</div>

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by mk

This problem does not exist on trunk since [13683]. It still exists on 1.2 however, because #14090 has not been backported.

I'm not sure whether this qualifies as a bug. If it is an enhancement this ticket should be closed as duplicate.

comment:3 Changed 4 years ago by mk

  • Resolution set to duplicate
  • Status changed from new to closed

Sorry for the spam, it has been backported. My bad.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.