[Answer]-How to check if a set field contains an specific value in Django?


This should work:

profiles = Profile.objects.filter(spoken_languages__idiom="language here")

Note that calling .filter() on a queryset does not change the queryset object. Instead, it creates and returns a clone with the new filters applied. So if you want to filter an existing queryset, you should do:

query_set = query_set.filter(spoken_languages__idiom="language here")

Leave a comment