Django HTTPResponseRedirect & Reverse with optional parameter
django, python
Solution
Not a direct answer but : why don't you just use the Messages framework (https://docs.djangoproject.com/en/1.6/ref/contrib/messages/).
Problem
How do I use Django's Reverse with an optional parameter for info? I keep on getting views.py: ``` def cartForm(request, prod): if request.method=="POST": quantity = request.POST.get('quantity', False) if quantity: add_to_cart(request, prod, quantity) return HttpResponseRedirect(reverse("cart")) #if no quantity indicated, display error message return HttpResponseRedirect(reverse('products.views.info', kwargs={'prod': prod, 'error':True})) def info(request, prod, error=False): prod = Product.objects.get(id=prod) return render(request, "products/info.html", dict(product = prod, error=error)) ``` urls.py: ``` url(r'^(?P<prod>\d+)/', "products.views.info", name='info'), ``` I keep on getting the following error: ``` Reverse for 'products.views.info' with arguments '()' and keyword arguments '{'prod': u'2', 'error': True}' not found. 1 pattern(s) tried: ['products/(?P<prod>\\d+)/'] ```