Published
- 1 min read
django filter not equal to
The solution for this is noted below
django filter not equal to
Solution
from myapp.models import Entry
from django.db.models import Q
# Returns all entries except those with 3 as their id
Entry.objects.filter(~Q(id=3))
Try other methods by searching on the site. That is if this doesn’t work