Code Reference

Field Lookups

Django · Methods reference

Django · Methods reference


📋 Overview

ORM lookup expressions via field__lookup=value.

🔧 Methods

Common lookups

LookupDescription
exact / iexactCase-sensitive / insensitive equality
contains / icontainsSubstring match
inValue in iterable
gt / gte / lt / lteComparisons
startswith / istartswith / endswith / iendswithPrefix/suffix
rangeBetween tuple endpoints
isnullTrue/False for NULL
regex / iregexDatabase regex
date / year / month / dayDate part extraction
year__gte etc.Chained transforms
F() expressionsCompare/update using column values
Q() objectsOR / complex boolean filter logic

💡 Examples

See parent topic notes for runnable snippets; this page is the complete method index.

⚠️ Pitfalls

  • Mutating methods return None in Python — do not chain sort() / reverse() expecting a new list.
  • Default JS sort() compares strings — pass (a,b) => a-b for numbers.
  • SQL function names differ by dialect — verify Postgres vs MySQL docs.
  • Django QuerySet.update() skips save() signals and auto auto_now fields on models.

On this page