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

Field Lookups - exact


Get all records where firstname is exactly "Emil":

mydata = Member.objects.filter(firstname__exact='Emil').values()
Run Example »

Definition and Usage

The exact lookup is used to get records with a specified value.

The exact lookup is case sensitive.

For a case insensitive search, use the iexact lookup.

SQL Equivalent

The SQL equivalent to the example above will be:

WHERE firstname = 'Emil';


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