Neat one off redirect

1
2
3
4
5
from django.http import HttpResponseRedirect

urlpatterns += patterns('',
  (r'^my_url$', lambda r: HttpResponseRedirect('http://www.google.com'))
)

More like this

  1. Internet Explorer Redirect Decorator by johnboxall 3 years, 3 months ago
  2. django redirects middleware a bit more fleixble by robertrv 2 years, 3 months ago
  3. HttpResponseRedirectView - Redirect to a view by adamlofts 3 years, 5 months ago
  4. View Redirect Decorators by bryanpieper 1 year, 7 months ago
  5. RedirectAnywhere by ayeowch 7 months, 2 weeks ago

Comments

mtrichardson (on September 11, 2008):

Why not just use django.views.generic.simple.redirect_to?

#

adamlofts (on September 11, 2008):

I wasn't aware of redirect_to which works equally well.

Having said that: the method above is a little more pleasing colour-wise in my editor and perhaps more intuitive?

#

(Forgotten your password?)