On Sat, Jul 2, 2011 at 8:07 AM, Matthew Gardner <mj...@byu.edu> wrote: > a = A.objects.get(pk=some_id) > b_set = a.b_set.select_related().all() # recommended in the Django > documentation for some queries > And b_set comes up empty, for some reason that I can't explain.
a.b_set isn't a QuerySet; it's a RelatedManager. For most uses, it's almost the same; but not exactly. try reversing the select_related() and all() calls (all() returns a QuerySet): b_set = a.b_set.all().select_related() -- Javier -- 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.