aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/relations.py
diff options
context:
space:
mode:
authorTom Christie2014-09-18 14:58:08 +0100
committerTom Christie2014-09-18 14:58:08 +0100
commit106362b437f45e04faaea759df57a66a8a2d7cfd (patch)
tree22410f7d4d0e8ccec5c4891505a1b4b6974d68af /rest_framework/relations.py
parent9fdb2280d11db126771686d626aa8a0247b8a46c (diff)
downloaddjango-rest-framework-106362b437f45e04faaea759df57a66a8a2d7cfd.tar.bz2
ModelSerializer.create() to handle many to many by default
Diffstat (limited to 'rest_framework/relations.py')
-rw-r--r--rest_framework/relations.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/rest_framework/relations.py b/rest_framework/relations.py
index 474d3e75..5aa1f8bd 100644
--- a/rest_framework/relations.py
+++ b/rest_framework/relations.py
@@ -24,7 +24,10 @@ class RelatedField(Field):
# We override this method in order to automagically create
# `ManyRelation` classes instead when `many=True` is set.
if kwargs.pop('many', False):
- return ManyRelation(child_relation=cls(*args, **kwargs))
+ return ManyRelation(
+ child_relation=cls(*args, **kwargs),
+ read_only=kwargs.get('read_only', False)
+ )
return super(RelatedField, cls).__new__(cls, *args, **kwargs)
def get_queryset(self):