Sunday, May 1, 2011

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

>  Oleg Lomaka <...@gmail.com> :
>
>> Hm... Again I think I have answered this question already.
>> Book.objects.annotate(s_count=Count('sequences')).filter(s_count=0)
>
> Right, but if you're trying to get book by id, this is not an option.
> Again, you will need to query db twice.
>

Besides, separate treating of books with and without sequences isn't
a good design decision, I believe.

--
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