Hi. This is probably trivial, but I've not managed to find the solution. How do I filter objects based on the count of a ManyToManyField?
My example: I have two classes -- Blog and Submission: class Blog( models.Model ): entries = models.ManyToManyField( Submission ) class Submission( models.Model ): [... whatever ] I want to fetch a list of all Blog instances which have at least one Submission , i.e. entries.count() > 0. Changing the model is not an option. I've been trying all kinds of permutations of filter, entries, count, gt, etc, such as: Blog.objects.filter(entries__count__gt = 0) No luck so far. Can somebody please help me? Thanks, Daniel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---