Is there a way to call filter on a queryset where one of the fieldnames is a variable?
For example I have something like:
models.py
Playlist.objects.filter(**{field_name: v})
To use field name string with icontains.
icontains
Try this
field_name = 'video' field_name_icontains = field_name + '__icontains' Playlist.objects.filter(**{field_name_icontains: v})