Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

Field Lookups - endswith


Example

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

mydata = Member.objects.filter(firstname__endswith='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 sensitive.

For a case insensitive search, use the iendswith 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__endswith='value'