> I need to get all blogs that belong to certain user and are empty (do
> not have any articles). I can't figure out how to make it with without
> extra() method.
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 ;)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---