Malcolm, does select_related work with 1-to-1's (and thus would do the
preloading)?

On Jun 28, 6:34 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sat, 2008-06-28 at 16:29 -0700, Julien wrote:
> > Hi,
>
> > You could try:
>
> > if hasattr(c, 'company')
> >     # This is a company
> > else:
> >     # This is a person
>
> That will still cause a database lookup (possibly two, if the model
> isn't a company). This is because there's no way to know which is the
> most descendant table for a particular row in the parent table without
> querying them all. So it requires a join that is O(# of descendents) in
> size, which is the reason it isn't done by defualt.
>
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
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