1👍
✅
The problem is that the url pattern in url.py
doesn’t match the url you entered.
You can use the request.GET
dictionary directly to read the query parameters.
For this change url pattern as
url(r'^loginfo/(?P<siteid>[0-9]+)', 'log_info', name='log_info'),
^loginfo/(?P<siteid>[0-9]+)
matchesloginfo
followed by any number of digits.
This ensures that if url has loginfo/1234
it will be redirected to log_info
, with 1234
as the siteid
Now change the view as
def log_info(request,siteid):
print 'siteid' + str( siteid )
# Changes made here.
print 'userid ' + request.GET[userId]
print 'sessionid ' + request.GET[sessionId]
print 'url ' + request.GET[url]
return render_to_response("products/all.html", locals(), context_instance=RequestContext(request))
Source:stackexchange.com