Skip to content

Instantly share code, notes, and snippets.

@GaretJax
Last active August 23, 2017 19:38
Show Gist options
  • Save GaretJax/4a1054123289c49cfc1a411c332b89c3 to your computer and use it in GitHub Desktop.
Save GaretJax/4a1054123289c49cfc1a411c332b89c3 to your computer and use it in GitHub Desktop.
form django.shortcuts import redirect
def redirect_job_details(request):
full_path = request.get_full_path()
if full_path.startswith('/en'):
full_path = full_path[3:]
return redirect('/jobs' + full_path)
urlpatterns = [
...
url(r'^detail/', redirect_job_details),
...
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment