This was actually the admin overriding the select related in my
manager with an empty one, which does not follow FK=null.

Adding this to my Admin class I was able to force the select_related
to behave.

    def queryset(self, request):
        return super(PageAdmin, self).queryset(request).select_related
('context__data_type', 'location')

I think this approach is a little unintuitive and will start a convo
on the dev list.

On Feb 20, 12:15 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Thu, Feb 19, 2009 at 7:10 PM, Trey <jameslon...@gmail.com> wrote:
>
> > I'm not sure if other people have stumbled onto this but I am having a
> > LOT of trouble getting the admin to use select related.
>
> You know select_related is a performance optimization, right?  It doesn't
> affect results in any way, just the number of database queries that may be
> required to produce a page.  It isn't clear from what you have written here
> how you are determining that select_related is not working.  Are you
> checking the number of queries issued somehow and seeing more than you would
> expect?  If so, explicitly listing the queries you are seeing vs. what you
> are expecting (which also might require more complete model and admin defs
> so people can understand the queries) would help people either explain why
> the queries that are being issued are correct, or point out how to adjust
> the admin defs to get the results you are expecting.
>
> If the problem is you are not seeing the results you are expecting on the
> admin pages, then it likely has nothing to do with select_related, and you
> need to more completely explain what you are expecting to see versus what
> you are seeing.
>
> Karen
--~--~---------~--~----~------------~-------~--~----~
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