Closed Simouche closed 2 years ago
django-phonenumber-field
delegates the actual number parsing to https://github.com/daviddrysdale/python-phonenumbers . Could you try to parse your phone number directly with that lower level library?
That would help to narrow down if this is a django-phonenumber-field
specific error or actually a problem in python-phonenumbers
.
here it is my friend, i think the issue is in django-phonenumber-field
:
>>> import phonenumbers
>>> x = phonenumbers.parse("+213799136332",None)
>>> x
>>> PhoneNumber(country_code=213, national_number=799136332, extension=None, italian_leading_zero=None, number_of_leading_zeros=None, country_code_source=0, preferred_domestic_carrier_code=None)
>>> y = phonenumbers.parse("0799136332","DZ")
>>> y
>>> PhoneNumber(country_code=213, national_number=799136332, extension=None, italian_leading_zero=None, number_of_leading_zeros=None, country_code_source=0, preferred_domestic_carrier_code=None)
>>> x == y
>>> True
@Simouche @stefanfoulis
I added PR #342 to show that the provided phone number is valid for both form and model. Please correct me if I missed something.
@Simouche are you still experiencing this issue?
When i enter my phone number "+213799136332" or any other valid algerian phone number, it doesn't accept it, throwing :
i tried changing to diffrent
PHONENUMBER_DB_FORMAT
none of them worked, i tried with default region asDZ
and entered a number with and without country code it throws:so please, any help is appreciated.