Q:

Django Querysets & dynamic string filtering

It seems that __in is only suitable for integers. I am trying to filter by strings.
I've tried this but it does not work. 
    groups = ['foo', 'bar'] 
    args = []
    for group in groups:
        args.append(Q(name=group))
    group_ids = Group.objects.filter(*args)

What is the preferred way to dynamically filter a Django queryset using strings?

A:

__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.

