mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-23 15:54:16 +03:00
pop required extra_kwargs if read_only is set
This commit is contained in:
parent
805a915e7c
commit
8c7b5fc5c1
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user