Opened 15 years ago

Closed 14 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: no UI/UX: no

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>

Change History (3)

comment:1 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Matthias Kestenholz, 14 years ago

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 by Matthias Kestenholz, 14 years ago

Resolution: duplicate
Status: newclosed

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

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