[Fixed]-Multiple request filtr from url Djjango


Don’t format the URL like that. There is a perfectly suitable way of passing queries in URLs, and that is to use a querystring:


(Also, why are you pretending your Django site is running on .NET? Don’t do that.)

Now your URL pattern just looks like this:

url(r'^productlist/$', 'shop.views.shoplist'),

and your view is:

def shoplist(request):
    categories = request.GET.getlist('category')
    if categories:
       products = ShopProduct.objects.filter(shop_product_category_id__in=categories)

Leave a comment