Reputation: 620
So i want to filter a queryset and get all objects that have a partial match to a word
queryset.filter(name=r'regex')
search term = app
I am really bad with regex any help would be greatly appreciated.
Upvotes: 4
Views: 6513
Reputation: 53659
You don't need a regex for a partial match, use contains
:
queryset.filter(name__contains='partial')
Or when you need a case-insensitive match:
queryset.filter(name__icontains='partial')
Upvotes: 10