Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Pro

Field Lookups - iendswith


Get all records where firstname ends with the letter "s":

mydata = Member.objects.filter(firstname__iendswith='s').values()
Run Example »

Definition and Usage

The endswith lookup is used to get records that ends with a specified value.

The endswith lookup is case insensitive.

For a case sensitive search, use the endswith lookup.

SQL Equivalent

The SQL equivalent to the example above will be:

WHERE firstname LIKE '%s';


All Field lookup keywords must be specified with the fieldname, followed by two(!) underscore characters __ and the keyword: