diff --git a/apps/common/serializers/fields.py b/apps/common/serializers/fields.py index e41a90944..cf92391e1 100644 --- a/apps/common/serializers/fields.py +++ b/apps/common/serializers/fields.py @@ -214,8 +214,11 @@ class BitChoicesField(TreeChoicesField): class PhoneField(serializers.CharField): def to_representation(self, value): if value: - phone = phonenumbers.parse(value, 'CN') - value = {'code': '+%s' % phone.country_code, 'phone': phone.national_number} + try: + phone = phonenumbers.parse(value, 'CN') + value = {'code': '+%s' % phone.country_code, 'phone': phone.national_number} + except phonenumbers.NumberParseException: + value = {'code': '+86', 'phone': value} return value