Back
What is the equivalent of this SQL statement in Django?
SELECT * FROM table_name WHERE string LIKE pattern;
How do I implement this in Django? I tried
result = table.objects.filter( pattern in string )
But that did not work. How do I implement this?
Try using __contains or __icontains (case-insensitive) like this:
__contains
__icontains
result = table.objects.filter(string__contains='pattern')
31k questions
32.8k answers
501 comments
693 users