Add comment creation to discussion API

This commit is contained in:
Greg Price
2015-05-27 15:28:57 -04:00
parent 64ffcb2e2b
commit 8fbfa2398e
10 changed files with 581 additions and 60 deletions

View File

@@ -27,7 +27,11 @@ class DeveloperErrorViewMixin(object):
if hasattr(validation_error, "message_dict"):
response_obj = {}
message_dict = dict(validation_error.message_dict)
non_field_error_list = message_dict.pop(NON_FIELD_ERRORS, None)
# Extract both Django form and DRF serializer non-field errors
non_field_error_list = (
message_dict.pop(NON_FIELD_ERRORS, []) +
message_dict.pop("non_field_errors", [])
)
if non_field_error_list:
response_obj["developer_message"] = non_field_error_list[0]
if message_dict: