I have a question class RegisterSerializer(ModelSerializer): username = CharField(required=True) class Meta: model = User fields = ['username', 'password', 'email'] def create(self, validated_data): if User.objects.filter(username=validated_data['username']).exists(): raise ValidationError('ushbu username mavjud!') if User.objects.filter(email=validated_data['email']).exists(): raise ValidationError("ushbu email mavjud!") user = User.objects.create_user( username=validated_data['username'], password=validated_data['password'], email=validated_data['email'] ) return user this message given for the first username in this serializer: if User.objects.filter(username=validated_data['username']).exists(): raise ValidationError('ushbu username mavjud!') it works, but the validation message for the email does not appear: if User.objects.filter(email=validated_data['email']).exists(): raise ValidationError("ushbu email mavjud!") instead, drf from its default message: "email": [ "user with this email already exists." ] Why is it being used? i expected validation error given inside serializer Continue reading...