mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-03-18 11:02:09 +00:00
fix: phone representation to string
This commit is contained in:
@@ -409,7 +409,7 @@ class PhoneField(serializers.CharField):
|
||||
def to_representation(self, value):
|
||||
try:
|
||||
phone = phonenumbers.parse(value, 'CN')
|
||||
value = {'code': '+%s' % phone.country_code, 'phone': phone.national_number}
|
||||
value = {'code': '+%s' % phone.country_code, 'phone': str(phone.national_number)}
|
||||
except phonenumbers.NumberParseException:
|
||||
value = {'code': '+86', 'phone': value}
|
||||
return value
|
||||
|
||||
Reference in New Issue
Block a user