i want achieve same question : redirect named url pattern directly urls.py in django?
but twist: application has namespace, , selected answer no longer works right.
it works if include namespace (app:
) in pattern_name
parameter of redirectview
:
project/urls.py
urlpatterns = patterns( '', url(r'^', include('app.urls', namespace='app', app_name='app') )
app/urls.py
urlpatterns = patterns( '', url(r'^newurl/$', my_view, name="my_view"), url(r'^oldurl/$', redirectview.as_view(pattern_name='app:my_view') )
but of course ugly , prevents app being reusable, undermines point of namespacing... surely, there way right, right?
Comments
Post a Comment