5👍
✅
RedirectView works. Capture the remainder of the path with a named kwarg. It will be passed into RedirectView.get_redirect_url
, so you can interpolate it into the url you provide.
url(r'^pattern1/(?P<url>.+)$', RedirectView.as_view(url="/pattern2/%(url)s")),
# ^ ^
# | this url appears here |
0👍
You can use redirect_to
generic view and add redirection urls in urls.py as:
from django.views.generic.simple import redirect_to
urlpatterns = patterns('',
('^pattern1/step1/$', redirect_to, {'url': '/pattern2/step1/'}),
#any more patters.
)
Here is documentation: Generic view redirect_to . These can take the parameters as well.
- [Django]-Django ImageField not uploading the image
- [Django]-Django.db.utils.DataError: numeric field overflow – django
- [Django]-Django models: how to overcome 'through' ManyToMany option limitation
- [Django]-What's the difference between settings.AUTH_USER_MODEL and django.contrib.auth.get_user_model?
- [Django]-Django Rest Framework Test case issue: 'HttpResponseNotAllowed' object has no attribute 'data'
- [Django]-Django Rest Framework – AssertionError in tests
- [Django]-How does django locale work between views
- [Django]-GAE: ImportError while using google-auth
- [Django]-Descriptor 'date' requires a 'datetime.datetime' object but received a 'unicode'
Source:stackexchange.com