0

I'm Prety new in Django. I want to know how to return to the previous page from view to template without taking path or url.

Antu
  • 2,197
  • 3
  • 25
  • 40

1 Answers1

2

Pretty sure this is a duplicate but

Try this:

from django.http import HttpResponseRedirect

def someview(request):
   ...
   return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
Henry Li
  • 174
  • 2
  • 16