0
我想添加一個按鈕,將通過產品名稱進行排序,價格等Django的篩選查詢中設置
這是我的看法:
def product_list(request, category_slug=None):
category = None
categories = Category.objects.filter(man=True)
products = Product.objects.filter(section='man', available=True)
flt = Product.objects.filter(section='man', available=True).order_by('-name')
products = products.filter(category=category)
return render(request,
'shop/product/list.html',
{'category': category,
'categories': categories,
'products': products,
'flt': flt})
我怎麼能按名稱排序,在點擊的價格等按鈕的?
我嘗試,但沒有工作,我的按鈕做什麼 – KeepItSick
給我你的HTML,其中包括按鈕動作 –
http://pastebin.com/LsNWR4Ct – KeepItSick