Django: Reversing a URL with a different template -
How do I change a URL but with a different template name? I must use specially urlresolvers.reverse
and be more specific:
I have only one view but two URLs from which it has access to Can be done
(r '^ url / $', 'view1', {'template1': 'template1.html'}, 'access-url1'), (r '^ Url_dynamic / $ ',' view1 ',' template1 ':' template_dynamic.html '},' url-dynamic '),
I do not want to type any code individually I'm going to change it on the fly because of which template the return comes in the scene. Therefore, I need flexibility to change the URL such as
urlresolvers.reverse ('view1', kwargs = {'template1': 'template_dynamic.html'}) (which does BitD Noreversematch is not working)
I can also copy view1
to view2
and call it url-dynamic I can, but it will violate drying.
urlresolvers.reverse
reverse's kwargs
that Match those people in the regex
pattern, which has not been passed through the URL in Dict.
You may want to use the reverse ('url-name').
Comments
Post a Comment