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
Line | Method | File |
226 | wrapper | /home/alex/Develop/Django/test/env/lib/python2.6/site-packages/django/contrib/admin/options.py |
186 | inner | /home/alex/Develop/Django/test/env/lib/python2.6/site-packages/django/contrib/admin/sites.py |
873 | change_view | /home/alex/Develop/Django/test/env/lib/python2.6/site-packages/django/contrib/admin/options.py |
590 | render_change_form | /home/alex/Develop/Django/test/env/lib/python2.6/site-packages/django/contrib/admin/options.py |
231 | render | /home/alex/Develop/Django/test/env/lib/python2.6/site-packages/django/contrib/admin/widgets.py |
36 | render | /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 , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
comment:3 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Sorry for the spam, it has been backported. My bad.
Note:
See TracTickets
for help on using tickets.
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.