10👍
To use field name string with icontains
.
Try this
field_name = 'video'
field_name_icontains = field_name + '__icontains'
Playlist.objects.filter(**{field_name_icontains: v})
- [Django]-Pycharm: set environment variable for run manage.py Task
- [Django]-Django storages: Import Error – no module named storages
- [Django]-Django: Fat models and skinny controllers?
Source:stackexchange.com