Thanks, you got me going on the right path.

On Feb 14, 12:31 pm, Jacob Kaplan-Moss <ja...@jacobian.org> wrote:
> On Mon, Feb 14, 2011 at 11:41 AM, Matteius <matte...@gmail.com> 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 the admin a queryset with select_related()?
>
> That is::
>
>     class GradeAdmin(admin.ModelAdmin):
>         def queryset(self, request):
>             return super(GradeAdmin,
> self).queryset(request).select_related('enrollment', 'assignment')
>
> (This is documented 
> here:http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contri...).
>
> This should work. If the admin doesn't respect the select_related
> call, then that's a bug.
>
> Jacob

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

Reply via email to