Skip to content

Commit

Permalink
style fix + check for read_only fields
Browse files Browse the repository at this point in the history
  • Loading branch information
aleontiev committed Nov 30, 2018
1 parent 96714e7 commit b75f64e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions dynamic_rest/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def _validate_patch_all(self, data):
'Unknown field: "%s"' % name
)
source = field.source or name
if source == '*':
if source == '*' or field.read_only:
raise ValidationError(
'Cannot update field: "%s"' % name
)
Expand Down Expand Up @@ -567,11 +567,8 @@ def update(self, request, *args, **kwargs):
""" # noqa
if self.ENABLE_BULK_UPDATE:
patch_all = self.get_request_patch_all()
if (
self.ENABLE_PATCH_ALL and
patch_all
):
# patch all update
if self.ENABLE_PATCH_ALL and patch_all:
# patch-all update
data = request.data
return self._patch_all(
data,
Expand Down

0 comments on commit b75f64e

Please sign in to comment.