Skip to content

Instantly share code, notes, and snippets.

@ionatan-israel
Forked from uolot/gist:4171107
Last active August 29, 2015 14:09
Show Gist options
  • Save ionatan-israel/23dc165acb509a683a52 to your computer and use it in GitHub Desktop.
Save ionatan-israel/23dc165acb509a683a52 to your computer and use it in GitHub Desktop.
# views.py
from django.views.generic import RedirectView
from django.core.urlresolvers import reverse
class NamedUrlRedirectView(RedirectView):
def __init__(self, url, *args, **kwargs):
self.url = reverse(url)
super(NamedUrlRedirectView, self).__init__(*args, **kwargs)
# in urls.py
(r'^blog/category/pictures/$', NamedUrlRedirectView().as_view(url='gallery-index'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment