Tutorials References Exercises Videos Menu
Website Get Certified Pro NEW

Field Lookups - istartswith


Example

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

mydata = Members.objects.filter(firstname__istartswith='s').values()
Run Example »

Definition and Usage

The istartswith lookup is used to get records that starts with a specified value.

The istartswith lookup is case insensitive.

For a case sensitive search, use the startswith lookup.


SQL Equivalent

The SQL equivalent to the example above will be:

WHERE firstname LIKE 's%';

Syntax

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

fieldname__istartswith='value'