redirect url django code example
Example 1: redirect django
from django.shortcuts import redirect
def my_view(request):
# ...
return redirect('some-view-name', foo='bar')
Example 2: django redirect to external url
from django.shortcuts import redirect
def optout(request):
return redirect("http://stackoverflow.com/")
Example 3: import redirect
from django.shortcuts import redirect