title: How can return previous page using django class view
body: <p>with my code, I can create tempfriend in 3 different page. so I'd like to make when I create tempfriend, I hope return previous page. how can I achieve it?</p>
  
  <p>When I use form_valid, there is no request, so <code>request.META</code> doesn't work. and if I use self.request, it create tempfriend and just return create page.</p>
  
  <pre><code>class tempfriend_create(FormView):
      form_class = forms.CreateTempfriendForm
      template_name = "tempfriends/create.html"
  
      def form_valid(self, form):
          tempfriend = form.save()
          form.instance.belongs_to = self.request.user
          tempfriend.save()
          return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
  </code></pre>