[Answer]-Filter from comma sep. list in django model "whole word"

1👍

I would probably use an extra model and a M2M relationship for the keywords to filter on. There are also dedicated packages for this like django-taggit.

But you could also use a regex filter:

Searchpage.objects.filter(keyword__regex=r'\bbar\b')

(haven’t tested this, but I think it should work)

👤ptrck

Leave a comment