0👍
✅
__in
can be used for strings as it translates to a SQL IN
operation. Whether or not it is case-sensitive my depend on your table/column collation.
2👍
Your query is doing an and
of all those values, and I assume you want an or
? Try:
query = Q(name=groups[0])
for group in groups[1:]:
query |= Q(name=group)
group_ids = Group.objects.filter(query)
- [Answered ]-Django-filter: add "All" filter option for AllValuesFilter with LinkWidget
- [Answered ]-I am having troubles with a 404-error message from Django. It says "No location found matching the query"
- [Answered ]-Serializing data results from query with select_related into json
Source:stackexchange.com