Branko Vukelic committed fff724b

Fixed #1: Actually return response object

Instead of calling render_to_response, simply propagate the response
object back to form_valid method so it can return it.

Comments (0)

Files changed (2)

                 # We assume that, if user was able to GET this response,
                 # and is now sending a POST via a form, the object must
                 # have gone AWOL in between. So we do a 410 (Gone).
-                self.related_object_gone()
+                return self.related_object_gone()
     def get_related_object_gone_message(self):
         return self.related_object_gone_message
     def related_object_gone(self):
-        return self.render_to_response(
-            HttpResponseGone(self.get_related_object_gone_message())
-        )
+        return HttpResponseGone(self.get_related_object_gone_message())
     def form_valid(self, form):
     def test_related_object_gone(self):
         self.view.request.method = 'POST'
         self.view.related_object_gone = Mock()
-        self.view.related_object_not_found()
+        response = self.view.related_object_not_found()
+        self.assertEqual(response, self.view.related_object_gone.return_value)
     def test_context(self):
         class Super(object):
  = self.view.get_related_object.return_value