当我选择排序时,我真的不能自动包含每页过滤器。如何使这些过滤器对彼此“可见”?我需要包括或阅读什么?
那是我观点的一小部分.py
if order == 'asc':
p = p.order_by('name')
elif order == 'desc':
p = p.order_by('-name')
elif order == 'price_asc':
p = p.order_by('price_netto')
elif order == 'price_desc':
p = p.order_by('-price_netto')
else:
p.order_by('name')
if limit == "12":
per_page = "12"
elif limit == "24":
per_page = "24"
elif limit == "48":
per_page = "48"
else:
from endless_pagination.settings import PER_PAGE
per_page = PER_PAGE
HTML
<select onchange="location = this.options[this.selectedIndex].value">
<option value="">--- Sortowanie ---</option>
<option rel="order" value="?order=desc">Malejąco według nazwy</option>
<option rel="order" value="?order=asc">Rosnąco według nazwy</option>
<option rel="order" value="?order=price_asc">Rosnąco według ceny</option>
<option rel="order" value="?order=price_desc">Malejąco według ceny</option>
</select>
Produktów na stronę:
<a rel="limit" href="?limit=12">12</a>, <a rel="limit" href="?limit=24">24</a>, <a rel="limit" href="?limit=48">48</a>