Last active
December 15, 2015 09:29
-
-
Save willvanwazer/5238937 to your computer and use it in GitHub Desktop.
Change in Django Redirects
This file contains 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
# In Django 1.4, this works fine: | |
from django.conf.urls.defaults import patterns, include, url | |
from django.views.generic.simple import redirect_to | |
urlpatterns = patterns('', | |
url(r'^redirect/', redirect_to, {'url': 'http://foo'}), | |
) | |
# In Django 1.5, it is changed to this: | |
from django.conf.urls.defaults import patterns, include, url | |
from django.views.generic import RedirectView | |
urlpatterns = patterns('', | |
url(r'^redirect/', RedirectView.as_view(url='http://foo')), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment