title: success url to the current url
body: <p>I'm using django class based view and forms. I want the view to stay on the same page after a new message has been submitted. The url is like</p>
  
  <pre><code>localhost:8000/chat/messages/username/
  </code></pre>
  
  <p>where 'username' is the username of the user to which the message is being sent</p>
  
  <pre><code>class ThreadView(LoginRequiredMixin, FormMixin, DetailView):
      template_name = 'thread.html'
      form_class = ComposeForm
  
      def get_queryset(self):
          return Thread.objects.by_user(self.request.user)
  
      def get_object(self):
          other_username  = self.kwargs.get("username")
          obj, created    = Thread.objects.get_or_new(self.request.user, other_username)
          if obj == None:
              raise Http404
          return obj
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          context['form'] = self.get_form()
          return context
  
      def post(self, request, *args, **kwargs):
          if not request.user.is_authenticated:
              return HttpResponseForbidden()
          self.object = self.get_object()
          form = self.get_form()
          if form.is_valid():
              return self.form_valid(form)
          else:
              return self.form_invalid(form)
  
      def form_valid(self, form):
          thread = self.get_object()
          user = self.request.user
          message = form.cleaned_data.get("message")
          ChatMessage.objects.create(user=user, thread=thread, message=message)
          return super().form_valid(form)
  </code></pre>
  
  <p>urls.py:</p>
  
  <pre><code>app_name = 'chat'
  
  urlpatterns = [
      path("", InboxView.as_view()),
      url(r'^messages/(?P&lt;username&gt;[\w.@+-]+)', ThreadView.as_view(), name="chaturl"),
  ]
  </code></pre>
  
  <p>If I give <code>success_url='./'</code> it's going to <code>locahost:8000/chat/messages/</code>, which results in a 404 error.</p>