diff options
| author | Philip Douglas | 2013-09-10 13:09:25 +0100 |
|---|---|---|
| committer | Philip Douglas | 2013-09-10 13:09:25 +0100 |
| commit | 39e13a0d1341c0a0e694acb1522a99470c4037be (patch) | |
| tree | 27b498f3cbf81faa1ff587d0730e07706c7551a8 /rest_framework/mixins.py | |
| parent | ef7ce344865938bea285a408a7cc415a7b90a83c (diff) | |
| parent | f5c34926d6a4b4b29fb083d25b99b10d7431eee4 (diff) | |
| download | django-rest-framework-39e13a0d1341c0a0e694acb1522a99470c4037be.tar.bz2 | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'rest_framework/mixins.py')
| -rw-r--r-- | rest_framework/mixins.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/rest_framework/mixins.py b/rest_framework/mixins.py index f11def6d..426865ff 100644 --- a/rest_framework/mixins.py +++ b/rest_framework/mixins.py @@ -142,11 +142,16 @@ class UpdateModelMixin(object): try: return self.get_object() except Http404: - # If this is a PUT-as-create operation, we need to ensure that - # we have relevant permissions, as if this was a POST request. - # This will either raise a PermissionDenied exception, - # or simply return None - self.check_permissions(clone_request(self.request, 'POST')) + if self.request.method == 'PUT': + # For PUT-as-create operation, we need to ensure that we have + # relevant permissions, as if this was a POST request. This + # will either raise a PermissionDenied exception, or simply + # return None. + self.check_permissions(clone_request(self.request, 'POST')) + else: + # PATCH requests where the object does not exist should still + # return a 404 response. + raise def pre_save(self, obj): """ |
