Skip to content

Instantly share code, notes, and snippets.

@willvanwazer
Last active December 15, 2015 09:29
Show Gist options
  • Save willvanwazer/5238937 to your computer and use it in GitHub Desktop.
Save willvanwazer/5238937 to your computer and use it in GitHub Desktop.
Change in Django Redirects
# 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