Commit d6d5b1d8 by Craig de Stigter

allow default values in writable serializer fields

parent c8416df0
......@@ -360,7 +360,9 @@ class BaseSerializer(WritableField):
except KeyError:
if self.required:
raise ValidationError(self.error_messages['required'])
return
if self.default is None:
return
value = copy.deepcopy(self.default)
# Set the serializer object if it exists
obj = getattr(self.parent.object, field_name) if self.parent.object else None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment