[Answer]-Django finding entries with NO ManyToMany

1👍

It’s a bit weird but the basic concept is that there will be an automatic reverse relationship on M1 called m2 and also there is a query filter called isnull which when applied to M2M relationships means that there is no link between the two models.

orphans = M1.objects.filter(m2_isnull=True)
👤Thomas

Leave a comment