if 'category' and 'something' and 'from_price' and 'to_price' in request.GET:
category = request.GET['category']
something = request.GET['something']
from_price = request.GET['from_price']
to_price = request.GET['to_price']
d = Data.objects.filter(Q(category = category)| Q(something = something)|Q(price__gt=from_price)|Q(price__lt=to_price))
如果我只填写(例如)如何过滤这些数据to_price
?(不是所有字段)
我的代码不能正常工作