fix: 手机号可以为空及验证逻辑修改

This commit is contained in:
jiangweidong
2023-04-10 17:19:22 +08:00
committed by Jiangjie.Bai
parent d8bf45c760
commit adfe4faf98
2 changed files with 9 additions and 3 deletions

View File

@@ -106,7 +106,7 @@ class UserSerializer(RolesSerializerMixin, CommonBulkSerializerMixin, serializer
allow_null=True, max_length=1024,
)
phone = PhoneField(
validators=[PhoneValidator()], required=False, allow_null=True, label=_("Phone")
validators=[PhoneValidator()], required=False, allow_blank=True, allow_null=True, label=_("Phone")
)
custom_m2m_fields = {
"system_roles": [BuiltinRole.system_user],