0Pricing
Django Academy · Lesson

Field Lookups and exclude()

Query with contains, gte, in, and more.

Beyond Equality

Plain filters check for equality, but real queries need ranges and text matches. Field lookups unlock that extra power.

The Double Underscore

A lookup is the field name, a double underscore, then the operator. That tiny syntax is how Django reads richer conditions.

Book.objects.filter(year__gte=2020)

All lessons in this course

  1. all(), get(), and filter()
  2. Field Lookups and exclude()
  3. order_by, Slicing, and Lazy Evaluation
  4. values, values_list, and count
← Back to Django Academy