Commit f8a1256b by Mark Aaron Shirley

Update RelatedField#field_from_native coding style

parent 2f5582a1
...@@ -351,13 +351,13 @@ class RelatedField(WritableField): ...@@ -351,13 +351,13 @@ class RelatedField(WritableField):
if self.read_only: if self.read_only:
return return
if field_name not in data and self.required: try:
raise ValidationError(self.error_messages['required']) value = data[field_name]
elif field_name not in data: except KeyError:
if self.required:
raise ValidationError(self.error_messages['required'])
return return
value = data.get(field_name)
if value in (None, '') and not self.null: if value in (None, '') and not self.null:
raise ValidationError('Value may not be null') raise ValidationError('Value may not be null')
elif value in (None, '') and self.null: elif value in (None, '') and self.null:
......
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