From 69d05b02dafde64b582643d277c6f7b118a158ed Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 12 Apr 2022 14:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=89=8B=E6=9C=BA=E5=8F=B7?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/auth1/authentication.py | 2 +- apps/hrm/serializers.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/auth1/authentication.py b/apps/auth1/authentication.py index 3c859439..c73f2f8f 100644 --- a/apps/auth1/authentication.py +++ b/apps/auth1/authentication.py @@ -13,7 +13,7 @@ class CustomBackend(ModelBackend): return try: user = UserModel._default_manager.get( - Q(username=username) | Q(phone=username) | Q(email=username)) + Q(username=username) | Q(email=username)) except UserModel.DoesNotExist: # Run the default password hasher once to reduce the timing # difference between an existing and a nonexistent user (#20760). diff --git a/apps/hrm/serializers.py b/apps/hrm/serializers.py index 681556e3..6ad797b2 100644 --- a/apps/hrm/serializers.py +++ b/apps/hrm/serializers.py @@ -3,7 +3,7 @@ from rest_framework.serializers import ModelSerializer from rest_framework import serializers from apps.utils.serializers import CustomModelSerializer - +from apps.utils.constants import EXCLUDE_FIELDS from .models import ClockRecord, Employee, NotWorkRemark from apps.system.serializers import DeptSimpleSerializer,UserSimpleSerializer @@ -11,7 +11,7 @@ class EmployeeSerializer(CustomModelSerializer): belong_dept_ = DeptSimpleSerializer(source='user.belong_dept', read_only=True) class Meta: model = Employee - exclude = ['face_data'] + exclude = EXCLUDE_FIELDS + ['face_data'] class EmployeeNotWorkRemarkSerializer(ModelSerializer): class Meta: