mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Modify '_writable_fields Method'
Reinforce against errors.
This commit is contained in:
parent
50c51c335e
commit
f5d6925312
|
@ -366,8 +366,13 @@ class Serializer(BaseSerializer):
|
||||||
ret = []
|
ret = []
|
||||||
for field in self.fields.values():
|
for field in self.fields.values():
|
||||||
if re.compile("\_set$").findall(field.source):
|
if re.compile("\_set$").findall(field.source):
|
||||||
for field in field.child._writable_fields:
|
try:
|
||||||
ret.append(field)
|
for field in field.child._writable_fields:
|
||||||
|
if (not field.read_only) or (field.default is not empty):
|
||||||
|
ret.append(field)
|
||||||
|
except:
|
||||||
|
if (not field.read_only) or (field.default is not empty):
|
||||||
|
ret.append(field)
|
||||||
continue
|
continue
|
||||||
if (not field.read_only) or (field.default is not empty):
|
if (not field.read_only) or (field.default is not empty):
|
||||||
ret.append(field)
|
ret.append(field)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user