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',`
- [Answer]-How to load Django new dynamic content in a Jquery Dialog?
- [Answer]-Load common content for the whole Django site
- [Answer]-How to save ForeignKey in queryset? 'NoneType' object has no attribute 'myfield'
- [Answer]-South – Migrate PyPI package
- [Answer]-Not stisfying the condition if request.is_ajax(): in django view
Source:stackexchange.com