2020-07-30 07:13:24 +00:00
|
|
|
from rest_framework import serializers, status
|
|
|
|
|
|
|
|
|
|
|
|
class EtebaseValidationError(serializers.ValidationError):
|
|
|
|
def __init__(self, code, detail, status_code=status.HTTP_400_BAD_REQUEST):
|
2020-11-14 15:04:41 +00:00
|
|
|
super().__init__(
|
2020-12-01 10:45:23 +00:00
|
|
|
{
|
|
|
|
"code": code,
|
|
|
|
"detail": detail,
|
|
|
|
}
|
2020-11-14 15:04:41 +00:00
|
|
|
)
|
2020-07-30 07:13:24 +00:00
|
|
|
self.status_code = status_code
|