Re: Query questions. Please help me.

2019-07-17 Thread 나르엔
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(

Re: Query questions. Please help me.

2019-07-17 Thread 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

Re: Query questions. Please help me.

2019-07-17 Thread 나르엔
Thank you! That's working! But I think it's just a AND condition. It's embarrassing, but what should I do with the OR conditions? def get_queryset(self): context = super(SearchListView, self).get_queryset() query = self.request.GET.get('q') selectOptions =

Re: Query questions. Please help me.

2019-07-17 Thread Jani Tiainen
Hi. You can use dictionary unpacking to kwargs. .filter(**{"name__contains": "foo", "somefield__gt": 123}) ke 17. heinäk. 2019 klo 23.04 나르엔 kirjoitti: > Hello, I am studying django. > > When I use objects.filter, I want to search various columns. > > Columns to search for are unknown and

Query questions. Please help me.

2019-07-17 Thread 나르엔
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.