On Friday 30 November 2012, Marek Brzóska wrote: > Has the matter been completely put away? > > I would like to bring it up again. > > I have Articles and Categories. An Article belongs to Categories: > > class Category(model): > pass > class Article(model): > category = ManyToManyField(Category) > status = CharField(max_length=10) > > Now I want all categories with articles that have status different than > "archived". > > I cannot do this with django's ORM! >
live_articles = Article.objects.exclude(status="archived") live_cats = Category.objects.filter(article__in=live_articles) Doesn't this do the trick for you? -- 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.