not equal to in django filter

35

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))
results = Model.objects.filter(x=5).exclude(a=True)

Comments

Submit
0 Comments