As an example:
view.py
def view1( request ):
return HttpResponse( "just a test..." )
urls.py
urlpatterns = patterns('',
url( r'^view1$', 'app1.view.view1'),
)
I want to get the URL path of view1. How can I do this.
I want to avoid hard coding any URL paths, such as “xxx/view1”.
You need
reverse.If you want to find out URL and redirect to it, use
redirectIf want to go further and not to hardcode your view names either, you can name your URL patterns and use these names instead.