Skip to content
Justice Tech School

Field Lookups

Double underscores add conditions: contains, icontains, startswith, gt, gte, lt, lte, in, range, isnull and year.

Example
Post.objects.filter(title__icontains="django")
Post.objects.filter(id__in=[1, 2, 3])
Post.objects.filter(created__year=2026)
Post.objects.filter(price__gte=10, price__lt=50)
Post.objects.filter(note__isnull=True)

Exercise

Case insensitive contains.

title__="x"

Quiz Test

What does __gte mean?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.