As far as i know, select_related doesn't work across reverse relationships. Sometimes it's possible to just query the base model to achieve the same results, but not always.
Maybe its a good feature for the query.py rewrite, but i'm thinking it could get ugly pretty fast. It would require a new parameter to specify which reverse relationships you want to cover, seeing as a mere select_related could give you a 20+ table join, 5+ second query :-) regards, Simon On May 21, 8:49 pm, Beau Hartshorne <[EMAIL PROTECTED]> wrote: > I've got some models that look something like this: > > class Entry(models.Model): > text = models.TextField() > > class SubEntry(models.Model): > text = models.TextField() > sub_entry = models.ForeignKey(Entry) > > class SubSubEntry(models.Model): > text = models.TextField() > sub_sub_entry = models.ForeignKey(SubEntry) > > So SubSubEntry.objects.select_related().all() gets the data from > SubEntry and Entry with one query. > > SubEntry.objects.select_related().all() gets the data from Entry with > one query, but not from SubSubEntry. What's the best way to work > around this? Or am I doing something wrong? > > Thanks, > Beau --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---