Update exceptions.py

I added a new exception class called Conflict to the Django REST framework. This exception is raised when a user's request conflicts with existing data in the system.
This commit is contained in:
mojtaba 2023-08-31 13:21:20 +03:30 committed by GitHub
parent 5a01a4c8a9
commit f277956924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -203,6 +203,10 @@ class NotFound(APIException):
default_detail = _('Not found.')
default_code = 'not_found'
class Conflict(APIException):
status_code = status.HTTP_409_CONFLICT
default_detail = _('Conflict request.')
default_code = 'conflict_error'
class MethodNotAllowed(APIException):
status_code = status.HTTP_405_METHOD_NOT_ALLOWED