Using resolve on url with query params in django -
using resolve on url without query params result in
resolve('/tracking/url/') resolvermatch(func=<function tracking_url_url @ 0x028d62b0>, args=(), kwargs={}, url_name='tracking-url-url', app_name='none', namespace='')
using resolve on url query params (the url works in browser) results in resolver404
error
resolve('/tracking/url/?url=home') traceback (most recent call last): file "<console>", line 1, in <module> file "c:\python27\lib\site-packages\django\core\urlresolvers.py", line 476, in resolve return get_resolver(urlconf).resolve(path) file "c:\python27\lib\site-packages\django\core\urlresolvers.py", line 352, in resolve raise resolver404({'tried': tried, 'path': new_path})
the url entry
url(r'^tracking/url/$', 'myauth.views.tracking_url_url', name='tracking-url-url'),
what best way resolve url query params , dict of qs same way i'm getting regular request, e.g, request.get.get('url')
.
thanks.
resolve()
, reverse()
not work on query parameters.
what can is: resolve url , append query parameter
"%s?url=home", resolve('/tracking/url/')
(see answer)
if want use request.get.get(...)
, why don't redirect view uses request.get.get(...)
?
from django.shortcuts import redirect django.core.urlresolvers import resolve def someviewfunction(): ... url = "%s?url=home", resolve('/tracking/url/') return redirect(url)
if not help, try specifying problem.
Comments
Post a Comment