Hello guys i have a problem with filtering. In my product listing page i want to let customers filter whatever they want. For example they have 10 checkbox with number of drawer. And they can choose 1,2,3,…,10. I can make filter if they choose 1 but i can’t code if they choose 2 or much.
here is my codes:
productlist = Urunler.objects.values('Resim','Urun_Kodu','Cekmece_Sayisi','M_Aciklama').filter(Q(Urun_Cesitleri__Link = products ), Q(Urun_Seviye = True))
if request.GET.get('cekmece'):
cekmece1 = request.GET.getlist('cekmece')
cekmece = request.GET.get('cekmece')
filters = ''
for cekmecee in cekmece1:
filters += str(Q(Cekmece_Sayisi__range = (cekmecee,int(cekmecee)+5)))
productlist = productlist.filter(filters)
I want to use ‘or’ condition for whatever customers choosed to listing products.
alsoi i don’t know which one i need to use cekmece1 and cekmece.