diff options
| author | Tom Christie | 2014-09-18 14:58:08 +0100 |
|---|---|---|
| committer | Tom Christie | 2014-09-18 14:58:08 +0100 |
| commit | 106362b437f45e04faaea759df57a66a8a2d7cfd (patch) | |
| tree | 22410f7d4d0e8ccec5c4891505a1b4b6974d68af /rest_framework/relations.py | |
| parent | 9fdb2280d11db126771686d626aa8a0247b8a46c (diff) | |
| download | django-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.py | 5 |
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): |
