1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | from django.views.generic.simple import redirect_to
urlpatterns = patterns('',
# ...your project's patterns...
)
# Your old/new URL tuples -- examples
redirects = (
('^kawasaki/zx750f', '/bikes/kawasaki/zx750f/'), # Matching a literal URL
('^gear/[0-9]+/$', '/gear/'), # Ignoring part of the matched URL
('^foo/(?P<id>\d+)/$', '/bar/%(id)s/'), # Oooh, parameter capture!
)
for oldurl, newurl in redirects:
urlpatterns += patterns('', (oldurl, redirect_to, {'url': newurl}))
|
More like this
- Currency filter by kljensen 4 years, 4 months ago
- View Permission Decorator Helper by jgeewax 3 years, 10 months ago
- Simple Age Verification Middleware by eculver 2 years, 9 months ago
- login_required decorator that doesn't redirect by brutasse 1 year, 3 months ago
- ThumbnailMixIn by johan 3 years, 1 month ago
Comments