> Here's a solution that should give you a list (not a QuerySet) of all > the blogs. Don't know if this is best practice though. You can get all > blogs of a user with: > user.blog_set.all() > From this QuerySet you want only these without articles: > blogs = [] > for blog in user.blog_set.all(): > #if the blog has no articles > if blog.article_set.all() == Article.objects.none(): > blogs.append(blog) > > Hope it works ;)
It does work without a doubt. But I am looking for mor efficient solution that would not require an extra query for every blog. I need to make this with a single query. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---