As others say, the reverse
function and url
templatetags can (should) be used for this.
I would recommend adding a name to your URL pattern.
urlpatterns = patterns('', url( r'^view1$', 'app1.view.view1', name='view1'), )
and cancel it thanks to this name
reverse('view1')
This will make your code easier to refactor.
source share