I am trying to filter a queryset using
info=members.filter(name__contains=search_string)
The problem I have is I do not know which field the user wants to search ahead of time so I need to substitute 'name' with a variable as in
variable_column = 'name'
search_type = 'contains'
filter = variable_column + '__' + search_type
info=members.filter(filter=search_string)
How do I do that?
Rich
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…