Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Field Lookups - exact


Example

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';

Syntax

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

fieldname__exact='value'