[Answered ]-Find all the ManyToManyField targets that are not connected to a ManyToManyField haver

1👍

You can work with:

Record.objects.filter(batch=None)

yes, I was amazed by that as well when I found out.

This works because Django for each relation makes a LEFT OUTER JOIN, so if there is no batch, it will join with a NULL/None record and so we can filter on that one.

Leave a comment