> > >> What precisely is wrong with: > >> > >> Category.objects.exclude(article_status='archived') > > > > It excludes all categories that have at least one archived article. > > > > And I want categories that have at least one NOT archived article. > > > > Example: I have one category: politics. I have two articles in this > > category: "Vote Obama!" which archived and "U.S wars" which is not > archived. > > Category.objects.exclude(article_status='archived') > > will show no categories, while I want my only category to show, because > > there is one not archived article, "U.S. wars". > > That's a very different question: > > > Category.objects.exclude(article__status='archived').annotate(num_articles=Count('article')).filter(num_articles__gt=0) > > Still answerable via the ORM. >
No! The moment you wrote exclude(article__status='archived') you excluded my category, because it has an article with status "archived". Please reread my original message, you seem to miss my point completely. > Marek Brzóska brzoskama...@gmail.com -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.