Sunday, May 1, 2011

Re: fetching data from intermediate many-to-many table

2011/5/1 Oleg Lomaka <...@gmail.com>:

> bs = BookSequence.objects.filter(book__pk=1).select_related()
> for s in bs:
>        print s.sequence.name, s.number_in_sequence

Oh, thanks!
Is it possible then to do left/right outer joins, as there may exist
books without
sequences and sequences without books?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment