[Fixed]-Django reverse not working with arguments


What you are expecting inside your view is a GET parameter from query string. Something your expected URL should be something like,


And below,

return HttpResponseRedirect(reverse('vendor_data', kwargs={'vendor_id':vendor_id}))

will redirect you to something like,


For which your view should expect an additional parameter vendor_id,

def vendorData(request, vendor_id):

and accordingly your rest of the code might change.

Solution to your problem:

return HttpResponseRedirect("{}?vendor_id={}".format(reverse('vendor_data'), vendor_id))

Leave a comment