I have two models - Photo and Tag - which are connected via a ManyToManyField.
class Photo(models.Model): tags = models.ManyToManyField(Tag) class Tag(m
Try sub-query w/ intermediate table
qs = Tag.objects.exclude(pk__in=Book.tags.through.objects.values('tag')) # then you could qs.delete() # or if you need to trigger signal per item for x in qs: x.delete()