mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Apply readonly on RelatedField
This commit is contained in:
parent
d1746e2f3c
commit
c341799344
|
@ -224,6 +224,9 @@ class RelatedField(WritableField):
|
|||
return self.to_native(value)
|
||||
|
||||
def field_from_native(self, data, field_name, into):
|
||||
if self.readonly:
|
||||
return
|
||||
|
||||
value = data.get(field_name)
|
||||
into[(self.source or field_name) + '_id'] = self.from_native(value)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user