How can I reverse a url but with a different template name? I specifically have to use urlresolvers.reverse
To be more specific:
I have one view but two urls from which it could be accessed
(r'^url/$', 'view1', {'template1':'template1.html'}, 'access-url1'),
(r'^url_dynamic/$', 'view1', {'template1':'template_dynamic.html'}, 'url-dynamic'),
I don't want to write any code differentiating what template to return in the view because I might want change it on the fly. So I need the flexibility to change the url while calling it for eg
urlresolvers.reverse('view1', kwargs = {'template1':'template_dynamic.html'})
(which btw does not work throws noreversematch)
I could also just copy view1
into view2
and call it with url-dynamic but that would violate DRY.