Здравствуйте! Подскажите пожалуйста как в Django из формы Bootstrap select class="form-select" произвести get запрос ?
HTML
<div class="col-sm-6">
<div class="input-group mb-3">
<span class="input-group-text">Sort By:</span>
<select class="form-select" aria-label="Sort by:">
<option value="default" name="order_by">Default</option>
<!-- <option value="1">Name (a-z)</option>
<option value="2">Name (z-a)</option> -->
<option value="price" name="order_by_price" selected>Price (low > high)</option>
<option value="- price" name="order_by_price">Price (high > low)</option>
</select>
</div>
</div>
VIEWS.PY
def category(request, category_slug):
page = request.GET.get('page', 1)
order_by_price = request.GET.get('order_by_price', None)
if category_slug == 'all':
goods = Products.objects.all()
else:
goods = get_list_or_404(Products.objects.filter(category__slug=category_slug))
if order_by_price and order_by_price != "default":
goods = goods.order_by(order_by_price)
paginator = Paginator(goods, 3)
current_page = paginator.page(page)
context = {
'goods': current_page,
'slug_url': category_slug,
'title': 'Страница категогрии',
}
return render(request, 'mall/category.html', context=context)
URLS.PY
urlpatterns = [
path('', views.mall, name='mall'),
path('shop/category/<slug:product_slug>/', views.products, name='products'),
path('<slug:category_slug>/', views.category, name='category'),
path('<slug:category_slug>/<int:page>/', views.category, name='category'),
path('shop/', views.shop, name='shop'),
path('shop/category/', views.shopcategory, name='shopcategory'),
]
Пробовал вставлять select в тег формы
<form action="{% url "mall:category" slug_url %}" method="get">
</form>
но ничего не вышло...
Нужно обязательно делать форму Django или можно как то иначе?