Skip to content

Instantly share code, notes, and snippets.

@vccabral
Created March 14, 2016 15:30
Show Gist options
  • Save vccabral/859d6c6c0ba9cb58e108 to your computer and use it in GitHub Desktop.
Save vccabral/859d6c6c0ba9cb58e108 to your computer and use it in GitHub Desktop.
redirect
from django.views.generic.base import RedirectView
class CustomRedirectView(RedirectView):
def get_redirect_url(self, *args, **kwargs):
return redirect("other/"+kwargs['extra_url'])
urlpatterns = patterns('',
...
url(r'^base/(?P<extra_url>.*)/$', CustomRedirectView.as_view(), name='redirect_view_name'),
url(r'^other/', include("otherapp.urls"),
..
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment