I'm trying to figure out how best to approach this.  I've got a site
model, and a few related models that are loaded in middleware and
stuck on almost every request.  I'd like to use select related for
this, but the site model also has foreignkey references from lots of
models I don't need. For example I've got a template lookup model, and
a per-page settings model that I'd like to have always there (it will
be cached).  Site is also related to a client model which is linked to
about 20 other models I definately don't need at every request.

What i'd like to be able to do is
Site.objects.get(pk=1).select_related(Settings,Templates), where
Settings and Templates are the related models I need pre-fetched at
every request.  select_related doesn't work like this, but I'm
wondering if there is some way to fake it.... or should I just skip
the orm and go raw sql to a fake model class?  I only need read access
so it shouldn't be too hard, but it seems like there should be a
better way.

>From the docs it looks like fkey=Null is an option, but not a
practical one for this.  Nor does depth do me much good due to the
model relationships involved.  Any advice would be much appreciated.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to