[Answer]-Redirected url not picked from urls.py

1👍

User reverse function in you view, first add a url name:

Httpresponseredirect(reverse('my_view_name', args=[variable]))

and (like @sushail said) fix the regexp:

urlpatterns = pattern('',
   url (r'^abc/xyz/(?P<variable>)/pqr/$' , 'view_name', name='my_view_name')
)

0👍

you need to use complete path as the regexpression matchs abc/xyz/…./pqr

Httpresponseredirect('/abc/xyz/%s/pqr/' %variable)

and like (like @lalo said)

urlpatterns = pattern('',
   url (r'^abc/xyz/(?P<variable>)/pqr/$' , 'view_name')
)

please checkwith / at begining and end, what is the view_name, it looks like you must have such a view in project directory,or you have to add the apppath in urlpatterns

`urlpatterns = pattern('<yourappname>.views',`

Leave a comment