Django query filter with variable column

后端 未结 2 1393
感情败类
感情败类 2020-11-29 16:48

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 t

2条回答
  •  清歌不尽
    2020-11-29 17:17

    Syntax:

    model_name.objects.filter(column_name='value')
    

    Ex: In my scenario, I wanted to find out all records with status completed from the Student table.

    Student.objects.filter(status="completed")
    

提交回复
热议问题