Serializers: fix an issue with handling validation errors.

master
Tom Hacohen 4 years ago
parent 7eb08d2946
commit 2de51b978a

@ -149,7 +149,7 @@ class BetterErrorsMixin:
ret.extend(self.flatten_errors("{}.{}".format(field_name, error_key), error)) ret.extend(self.flatten_errors("{}.{}".format(field_name, error_key), error))
else: else:
for error in errors: for error in errors:
if error.messages: if getattr(error, "messages", None):
message = error.messages[0] message = error.messages[0]
else: else:
message = str(error) message = str(error)

Loading…
Cancel
Save