title: Django - redirect to a view after edit
body: <p>I have a view that allows me to edit/update a post. The post is the result of filling out a form. This is similar I'm guessing to redirecting to a CMS post after editing.  Here's the post view:</p>
  
  <pre><code>class PostUpdateView(UpdateView):
     model = Product
     form_class = ProductForm
     template_name = 'edit_product.html'
  
     def form_valid(self, form):
        self.object = form.save(commit=False)
        self.object.save()
        return redirect ('products')
  
     @method_decorator(login_required)
     def dispatch(self, request, *args, **kwargs):
       return super(PostUpdateView, self).dispatch(request, *args, **kwargs)
  </code></pre>
  
  <p>After updating the details in the form it redirects to the 'product' page, whereas I want to redirect to the item just edited.  The URL for the items is:</p>
  
  <pre><code>url(r'^([0-9]+)/$', views.detail, name = 'detail'),
  </code></pre>
  
  <p>Each post is then a number in the url, such as <code>http://127.0.0.1:8000/13/</code>.  I can redirect to the previous page, but takes me back to the edit view, whereas, I want to go back to the actual post view, showing the edit.  Hopefully this isn't clear as mud.</p>
  
  <p>I get the sense I need to grap the orginating url, then use it once the form is updated so I'm researching that right now.  Any guidance gratefully received.</p>