Commit 5c680c36 by Mark Aaron Shirley

Check if RelatedField is required.

parent c13f132a
......@@ -351,6 +351,11 @@ class RelatedField(WritableField):
if self.read_only:
return
if field_name not in data and self.required:
raise ValidationError(self.error_messages['required'])
elif field_name not in data:
return
value = data.get(field_name)
if value in (None, '') and not 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