diff options
| author | Tom Christie | 2013-08-30 09:28:33 +0100 | 
|---|---|---|
| committer | Tom Christie | 2013-08-30 09:28:33 +0100 | 
| commit | 9a5b2eefa92dede844ab94d049093e91ac98af5b (patch) | |
| tree | faf389e2f8c8296aeaa486ab97ed0be9113cc2ba /rest_framework/mixins.py | |
| parent | bf07b8e616bd92e4ae3c2c09b198181d7075e6bd (diff) | |
| parent | f3ab0b2b1d5734314dbe3cdd13cd7c4f0531bf7d (diff) | |
| download | django-rest-framework-9a5b2eefa92dede844ab94d049093e91ac98af5b.tar.bz2 | |
Merge 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 679dfa6c..2c85d157 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):          """ | 
