[Answered ]-Django: name 'filter_name__icontains' is not defined

1👍

While filter_name is a variable, you did not define filter_name__icontains. You can use string formatting for this:

queryset = queryset.filter(**{f'{filter_name}__icontains': term.get(filter_name)})

Leave a comment