2👍
✅
Here is the reverse of __contains
:
from django.db.models import Q
qs = MyModel.objects.filter(~Q(icon__contains='any string'))
If you want to check if value is None
you could use isnull e.g. Do not include those objects for which icon is None:
qs = MyModel.objects.filter(icon__isnull=True)
Source:stackexchange.com