I want to find how many Resources in my dataset have no Widgets associated with them. Resources and Widgets have a ManyToMany relationship:
class Resource(models.Model): widgets = models.ManyToManyField(Widget, null=True, blank=True) I finally settled on the code below, but I was wondering if there was a better way to express this: print "No widgets", Resource.objects.exclude(widgets__in=Widget.objects.all()).count() Thanks! -- Rob Carlson r...@vees.net http://vees.net/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.