title: Django Rest Framework validate method not working
body: <p>This is my first task that I'm doing in Rest Framework.I referred a video tutorial to do this and it's weird why my validate method in serializer not working even if I totally copied the code from the video.
  Below is my view function:</p>
  
  <pre><code>class UserLoginAPIView(APIView):
  
      permission_classes = [AllowAny]
      serializer_class = UserLoginSerializer
  
      def post(self, request, *args, **kwargs):
          data = request.data
          serializer = UserLoginSerializer(data=data)
          if serializer.is_valid(raise_exception=True):
              new_data = serializer.data
              return Response(new_data, status=HTTP_200_OK)  //I'm getting this response
          return Response(serializer.errors, status=HTTP_400_BAD_REQUEST)
  </code></pre>
  
  <p>and my serializer:</p>
  
  <p>class UserLoginSerializer(ModelSerializer):</p>
  
  <pre><code>token = CharField(allow_blank=True, read_only=True)
  username = CharField(required=False, allow_blank=True)
  email = EmailField(label='Email Address', required=False, allow_blank=True)
  
  class Meta:
      model = User
      fields = [
          'username',
          'email',
          'password',
          'token',
      ]
      extra_kwargs = {"password":
                          {"write_only": True}
                      }
  
      def validate(self, data):
          print("***************validating*******************")
          # user_obj = None
          email = data.get("email", None)
          username = data.get("username", None)
          password = data["password"]
          if not email and not username:
              raise ValidationError("A username or email is required to login.")
          user = User.objects.filter(
                  Q(email=email) |
                  Q(username=username)
              ).distinct()
          user = user.exclude(email__isnull=True).exclude(email__iexact='')
          print(user, "-------------*********************")
          if user.exists() and user.count() == 1:
              user_obj = user.first()
          else:
              raise ValidationError("This username/email is not valid.")
          if user_obj:
              if not user_obj.check_password(password):
                  print("wrong pwd", "**************************************")
                  raise ValidationError("Incorrect credentials! Please Try again!")
          data["token"] = "SOME RANDOM TOKEN"
          return data
  </code></pre>
  
  <p>As the first line in validate method not being executed, how am I getting the response(200_OK)? Please help me with this..</p>