So I've been implementing the new Django 1.2 and 1.3 methods such as
queryset in my admin.py for my Classcomm student models.  All is going
well, in the case of an Add/Edit DDO page I went from having 82/87 to
6/10 queries which makes things now much more tolerable.  However I
still have a concern that has developed into a hypothesis and that is:
On Admin TabularInlines  ForeignKey User fields will generate 2
queries per User selection widget where each query looks like:

0.57    SELECT
EXPLAIN

Toggle Stacktrace

SELECT `auth_user`.`id`, `auth_user`.`username`,
`auth_user`.`first_name`, `auth_user`.`last_name`,
`auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`,
`auth_user`.`is_active`, `auth_user`.`is_superuser`,
`auth_user`.`last_login`, `auth_user`.`date_joined` FROM `auth_user`

Well so for example, I have 2 of these queries at least on any
Department Add/Edit page because I have a TabularInline Couse widget.
I get 2 queries for the first widget, and if the Department has n
courses then I get n additional query lines all with the identical
query.  This is one case where I really wish I had johny-cacheing in
place!

It is also bad for a Course Edit Page with 3 Tabular Inline:
Instructors, Mentors and Assignments.  In this case I get 5 identical
auth_user queries: I'm guessing 1 for the Course.course_director
field. And 2 each for the Instructor and Mentor auth_user ForeignKey
fields.  My guess is there is a bug in the widget code or template
that is generating this query twice initially? and the subsequent
queries are the summation of queries considering queries won't be
reused, but rather regenerated across the original admin fieldsets and
each admin Inline.  More work will go into simplifying these queries
in the admin, and please offer any suggestions or if my hypothesis
sounds correct to you.

Thanks, Best Regards,
matt

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to