Re: Getting Slammed Hard on Foreign Keys in the admin due to __unicode__

2011-02-17 Thread Matteius
I just thought because I did surgery on my own neck once I'd be able to go to the guilde of surgeons. On Feb 16, 7:12 pm, Luke Plant wrote: > On Wed, 2011-02-16 at 11:36 -0800, Matteius wrote: > > OK got it down to 15 using another def queryset in the Assignment > > admin.TabularInline.  I'm stil

Re: Getting Slammed Hard on Foreign Keys in the admin due to __unicode__

2011-02-16 Thread Luke Plant
On Wed, 2011-02-16 at 11:36 -0800, Matteius wrote: > OK got it down to 15 using another def queryset in the Assignment > admin.TabularInline. I'm still not sure why it is executing the > following query 5 times, but it is (half the total time of the total > queries): We are very definitely into d

Re: Getting Slammed Hard on Foreign Keys in the admin due to __unicode__

2011-02-16 Thread Matteius
OK got it down to 15 using another def queryset in the Assignment admin.TabularInline. I'm still not sure why it is executing the following query 5 times, but it is (half the total time of the total queries): 0.56SELECT EXPLAIN Toggle Stacktrace SELECT `auth_user`.`id`, `auth_user`.`usernam

Re: Getting Slammed Hard on Foreign Keys in the admin due to __unicode__

2011-02-15 Thread Matteius
OK this suggestion has gotten me part of the way and certainly improved the state of the admin. However, I'm still getting linear dependence in the admin now in the case of inline editing. I have Assignments, Instructor and Mentors all with a ForeignKey to Course. Well for the example of a new C

Re: Getting Slammed Hard on Foreign Keys in the admin due to __unicode__

2011-02-15 Thread Matteius
Thanks, you got me going on the right path. On Feb 14, 12:31 pm, Jacob Kaplan-Moss wrote: > On Mon, Feb 14, 2011 at 11:41 AM, Matteius wrote: > > No the hits are with the initial page load before any AJAX gets > > called, my AJAX code is 2 DB hits.  I am not claiming select_related > > should be

Re: Getting Slammed Hard on Foreign Keys in the admin due to __unicode__

2011-02-14 Thread Jacob Kaplan-Moss
On Mon, Feb 14, 2011 at 11:41 AM, Matteius wrote: > No the hits are with the initial page load before any AJAX gets > called, my AJAX code is 2 DB hits.  I am not claiming select_related > should be default, but somehow it should be an option for the admin > change form. Have you tried supplying

Re: Getting Slammed Hard on Foreign Keys in the admin due to __unicode__

2011-02-14 Thread Matteius
No the hits are with the initial page load before any AJAX gets called, my AJAX code is 2 DB hits. I am not claiming select_related should be default, but somehow it should be an option for the admin change form. Here is why, here is an example of the worst cases: You'll see two different Foreign

Re: Getting Slammed Hard on Foreign Keys in the admin due to __unicode__

2011-02-13 Thread Stephen Burrows
Though it's a little hard to tell from your post, this sounds more like it's definitely a case where your code needs improvement. From what I understand, the database hits are coming from your custom AJAX, not from the admin's default behavior. Also, you already know the solution: use select_relate

Getting Slammed Hard on Foreign Keys in the admin due to __unicode__

2011-02-13 Thread Matteius
I have a very small test database on my test development virtualbox environment and so while I've been adding in custom AJAX for dynamic ForeignKey filters (in the case of Enrollment's Assignment list) I noticed that because I'm using the Django Debug Toolbar. Well on these pages with only ~28 Enr