aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/fields.py
diff options
context:
space:
mode:
authorIan Strachan2012-10-22 22:24:26 +0100
committerIan Strachan2012-10-22 22:24:26 +0100
commitc7a0d52fd7e22fbc4a01ff900bd3b2c1215e984d (patch)
tree164bc17f49ff80155edf846e94855369b8228878 /rest_framework/fields.py
parentaba0172f5c988af145113678fe3d4f411111d4ff (diff)
downloaddjango-rest-framework-c7a0d52fd7e22fbc4a01ff900bd3b2c1215e984d.tar.bz2
#314 Fix for manytomany field being required in the payload even though the field is specified as readonly in the serializer
Diffstat (limited to 'rest_framework/fields.py')
-rw-r--r--rest_framework/fields.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index f610d6aa..6ed37823 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -256,6 +256,9 @@ class ManyRelatedMixin(object):
return [self.to_native(item) for item in value.all()]
def field_from_native(self, data, field_name, into):
+ if self.readonly:
+ return
+
try:
# Form data
value = data.getlist(self.source or field_name)