Применение фильтрации к текущей странице

Как я могу передать url текущей странице в форму фильтрации? action привязан к url, как я могу динамически изменять этот параметр чтобы фильтрация применялась к текущей странице? например я выбрал категорию товаров и хочу отсортировать их по цене.

template

<form name="selectForm" action="{% url 'shop' %}" method="get">
     <label for="orderby"></label>
      <select name="orderby" id="orderby" onchange="selectForm.submit();">
         <option value="">default</option>
         <option value="price">price: $ - $$</option>
         <option value="-price">price: $$ - $</option>           
     </select>
     <input type="submit" class="d-none" value="submit">

views

class Shop(ListView):
    template_name = 'essense/shop.html'
    context_object_name = 'items'
    paginate_by = 9
    allow_empty = True
    model = Item

    def get_context_data(self, *, object_list=None, **kwargs):
        context = super().get_context_data(**kwargs)
        ***context***

        return context
    def get_ordering(self):
       return self.request.GET.get('orderby', )

class ShopBySubCategory(Shop, ListView):
    def get_queryset(self):
        return Item.objects.filter(sub_category__slug=self.kwargs['slug'])


class ShopByBrand(Shop, ListView):
    def get_queryset(self):
        return Item.objects.filter(brand__slug=self.kwargs['slug'])

urls

urlpatterns = [
    path('', index, name='home'),
    path('blog', blog, name='blog'),
    # path('shop/', shop, name='shop'),
    path('shop/', Shop.as_view(), name='shop'),
    path('shop/category/<slug:slug>', ShopBySubCategory.as_view(), name='shop_category'),
    path('shop/brand/<slug:slug>', ShopByBrand.as_view(), name='shop_brand'),
    path('shop/<slug:slug>/', ItemDetail.as_view(), name='single_product')

]

Ответы (0 шт):