How to get request GET in django, without using form?

Something

...

from future import unicode_literals from django.shortcuts import render from products.models import *

def catalog(request): product_id = int(request.GET["value"]) products_images_armatura = products_images.filter(product__category__id=product_id) return render(request, 'shop.html', locals())

#This code says: MultiValueDictKeyError at /catalog/


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

Автор решения: Andrey Maslov

looks like that GET has no value parameter.

don't use requests.GET['PARAM_NAME'], use requests.GET.get('PARAM_NAME') it will return None if there is no PARAM_NAME in GET

→ Ссылка