Docstrings

This commit is contained in:
Tom Christie 2016-10-10 20:38:43 +01:00
parent 117a24cfc6
commit 2a3d07d9d3
2 changed files with 11 additions and 1 deletions

View File

@ -182,7 +182,7 @@ By default this exception results in a response with the HTTP status code "429 T
## ValidationError ## ValidationError
**Signature:** `ValidationError(detail)` **Signature:** `ValidationError(detail, code=None)`
The `ValidationError` exception is slightly different from the other `APIException` classes: The `ValidationError` exception is slightly different from the other `APIException` classes:

View File

@ -119,9 +119,19 @@ class ValidationError(APIException):
return six.text_type(self.detail) return six.text_type(self.detail)
def get_codes(self): def get_codes(self):
"""
Return only the code part of the error details.
Eg. {"name": ["required"]}
"""
return _get_codes(self.detail) return _get_codes(self.detail)
def get_full_details(self): def get_full_details(self):
"""
Return both the message & code parts of the error details.
Eg. {"name": [{"message": "This field is required.", "code": "required"}]}
"""
return _get_full_details(self.detail) return _get_full_details(self.detail)