Redirect / return to same (previous) page in Django?

One of the way is using HTTP_REFERER header like as below:

from django.http import HttpResponseRedirect

def someview(request):
   ...
   return HttpResponseRedirect(request.META.get('HTTP_REFERER'))

Not sure of cons of this!

Leave a Comment