from rest_framework import status
import rest_framework.exceptions


class ValidationError(rest_framework.exceptions.ValidationError):
    code = ''

    def __init__(self, detail, code=None, status_code=status.HTTP_400_BAD_REQUEST):
        super(ValidationError, self).__init__(detail)
        self.status_code = status_code
        self.code = code

from rest_framework import status
import rest_framework.exceptions


class ValidationError(rest_framework.exceptions.APIException):
    code = ''

    def __init__(self, detail, code=None, status_code=status.HTTP_400_BAD_REQUEST):
        super(ValidationError, self).__init__(detail)
        self.code = code
        self.status_code = status_code

Fix Validation import error in older DRF.
Fix Validation import error in older DRF.

  from rest_framework import status
  import rest_framework.exceptions
  
  
- class ValidationError(rest_framework.exceptions.ValidationError):
+ class ValidationError(rest_framework.exceptions.APIException):
      code = ''
  
      def __init__(self, detail, code=None, status_code=status.HTTP_400_BAD_REQUEST):
          super(ValidationError, self).__init__(detail)
+         self.code = code
          self.status_code = status_code
-         self.code = code
  
Fix Validation import error in older DRF.
## Code Before:
from rest_framework import status
import rest_framework.exceptions


class ValidationError(rest_framework.exceptions.ValidationError):
    code = ''

    def __init__(self, detail, code=None, status_code=status.HTTP_400_BAD_REQUEST):
        super(ValidationError, self).__init__(detail)
        self.status_code = status_code
        self.code = code

## Instruction:
Fix Validation import error in older DRF.
## Code After:
from rest_framework import status
import rest_framework.exceptions


class ValidationError(rest_framework.exceptions.APIException):
    code = ''

    def __init__(self, detail, code=None, status_code=status.HTTP_400_BAD_REQUEST):
        super(ValidationError, self).__init__(detail)
        self.code = code
        self.status_code = status_code
