-
-
Save ionatan-israel/23dc165acb509a683a52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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