Using django.Filter() to search or filter the details of posts already saved in django.
Using Q of django to make search in queryset. using checkbox, so that this filter(), to add a filter in my webpage when --
/?q=Bangalore
Im getting correct value as
LOCATION BANGALORE PUNE
ujjwal
56789
hgjk@hgjhk.vds
bottle
bisleri
bangalore
Sept. 20, 2018, 3 p.m.
but when I am selecting both of the checkbox and perform search:
?q=Bangalore&q=Pune
if you notice the above url , it is performing '&' (and) opertion and, rather i want to show in search, the data of either of the value. Suppose, in database only, Bangalore is saved but not pune or vice-versa. It is showing nothing . ..
my code:
if query:
queryset = queryset.filter(
Q(Name__icontains = query) |
Q(Location__icontains= query) )
Hope I am able to make you understand my situation..