title: How to redirect to previous page in Django after POST request
body: <p>I face a problem which I can't find a solution for. I have a button in navbar which is available on all pages and it is a button responsible for creating some content. </p>
  
  <p>View that links with button:</p>
  
  <pre><code>def createadv(request):
      uw = getuw(request.user.username)
      if request.method =='POST':
      form = AdverForm(request.POST, request.FILES)
      if form.is_valid():
          form.instance.user = request.user
          form.save()
          return HttpResponseRedirect('/', {'username': request.user.username, 'uw': uw})
      args = {}
      args.update(csrf(request))
      args['username'] = request.user.username
      args['form'] = AdverForm()
      args['uw'] = uw
      return  render_to_response('createadv.html', args)
  </code></pre>
  
  <p>If you can see now I always redirect to main page '/' after creating content but I want to go back to the page with which I launched the creation of content.</p>