From 675a9090ab2f30bbe477be28f0b9b983b01c30ef Mon Sep 17 00:00:00 2001 From: kamos Date: Fri, 20 Apr 2018 13:45:29 -0400 Subject: [PATCH] Added exception class for HTTP 409 responses --- rest_framework/exceptions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py index f79b16129..8bdf512fc 100644 --- a/rest_framework/exceptions.py +++ b/rest_framework/exceptions.py @@ -209,6 +209,12 @@ class NotAcceptable(APIException): super(NotAcceptable, self).__init__(detail, code) +class Conflict(APIException): + status_code = status.HTTP_409_CONFLICT + default_detail = _('Conflict with the current state of the target resource.') + default_code = 'conflict' + + class UnsupportedMediaType(APIException): status_code = status.HTTP_415_UNSUPPORTED_MEDIA_TYPE default_detail = _('Unsupported media type "{media_type}" in request.')