I've solved it like this.
Thank you for your help.

def get_queryset(self):
context = super(SearchListView, self).get_queryset()
query = self.request.GET.get('q')
selectOptions = self.request.GET.getlist('selectoptions')
argument_list = []
for field in selectOptions:
argument_list.append( Q(**{field+'__icontains':query}))
context = assetsInfo.objects.filter( reduce(operator.or_, argument_list))
return context

2019년 7월 18일 목요일 오전 11시 31분 7초 UTC+9, Yoo 님의 말:
>
> Take a look at Q objects: 
> https://docs.djangoproject.com/en/2.2/topics/db/queries/#complex-lookups-with-q-objects
>
> On Wednesday, July 17, 2019 at 4:04:16 PM UTC-4, 나르엔 wrote:
>>
>> Hello, I am studying django.
>>
>> When I use objects.filter, I want to search various columns. 
>>
>> Columns to search for are unknown and have been receiving columns to 
>> search through checkbox in html.
>>
>> What should I do? Please teach me.
>> It's blocked from below.
>> selectoptions is name in checkbox.
>>
>>
>> -------
>> def get_queryset(self):
>>         context = super(SearchListView, self).get_queryset()
>>         query = self.request.GET.get('q')
>>         selectOptions = self.request.GET.getlist('selectoptions')
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7218b4c6-5734-4cca-9b1a-098f41899f39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to