django - query filter on manytomany is empty
Adding to @Bernhard answer, other possible solution can be achieved using the Q()
object.
from django.db.models import Q
filters = Q(manytomany=None)
TestModel.objects.filter(filters)
Negation:
filters = ~Q(manytomany=None)
TestModel.objects.filter(filters)
print TestModel.objects.filter(manytomany=None)