Permalink
Browse files

Obey always_return data in patch_detail.

  • Loading branch information...
1 parent 7d998a2 commit 7cfa0670a127d0c0f8b389264abfeb02931aec42 @onyxfish onyxfish committed Apr 17, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 tastypie/resources.py
View
8 tastypie/resources.py
@@ -1341,7 +1341,13 @@ def patch_detail(self, request, **kwargs):
# Now update the bundle in-place.
deserialized = self.deserialize(request, request.raw_post_data, format=request.META.get('CONTENT_TYPE', 'application/json'))
self.update_in_place(request, bundle, deserialized)
- return http.HttpAccepted()
+
+ if not self._meta.always_return_data:
+ return http.HttpAccepted()
+ else:
+ bundle = self.full_dehydrate(bundle)
+ bundle = self.alter_detail_data_to_serialize(request, bundle)
+ return self.create_response(request, bundle, response_class=http.HttpAccepted)
def update_in_place(self, request, original_bundle, new_data):
"""

0 comments on commit 7cfa067

Please sign in to comment.