pop required extra_kwargs if read_only is set

This commit is contained in:
S. Andrew Sheppard 2015-05-27 21:14:08 -05:00
parent 805a915e7c
commit 8c7b5fc5c1

View File

@ -1088,6 +1088,9 @@ class ModelSerializer(Serializer):
if extra_kwargs.get('default') and kwargs.get('required') is False:
kwargs.pop('required')
if kwargs.get('read_only', False):
extra_kwargs.pop('required', None)
kwargs.update(extra_kwargs)
return kwargs