Default Country Code?
See original GitHub issueIs there a way append a default country code? If no Country code is typed?
I am thinking along the lines of,
mobile = PhoneNumberField(required=True, country='india')
or
mobile = PhoneNumberField(required=True, country='+91')
My users are not smart enough to add their own country code, sometimes. It raises few errors. I currently tell them add the country code in a html placeholder.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Change the default country code
Click Admin. Under Account Settings, click Organization Settings. Click the Settings tab. Under Default Country Code, select a country code. Click Save.
Read more >How to Change Default Country Code For Phone Number ...
Make a tap on the list in the Phone number country code section. Now, select the country from the list and hit the...
Read more >Gmail: How to Change the Default Country Code for Phone ...
In the General tab of the settings, the second section “Phone numbers” allows you to select a default country code. Select the country...
Read more >Why does the country code default to +1 when I add a ...
Answer. The Support interface and Twilio backend design defaults the country code to US country code +1 if your phone number is nine...
Read more >IBM-supplied country code defaults
Country/ region Country code Currency symbol Int. currency symbol Time picture string Da...
Afghanistan AF X'9F404040' AFN HH:MI:SS YY...
Albania AL Lek ALL HH:MI:SS YY...
Algeria...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
HI @CT83, I think you can add this config
PHONENUMBER_DEFAULT_REGION = "IN"
insettings.py
.Passing a region is not meant to restrict phone numbers to a given region, it is meant to interpret regional phone number input in the context of a specified region. It is not meant to force users to have a phone number in the given region.
For example, North American phone numbers are usually written
6044011234
. That number only works for people calling from the North America, it is regional. To call it from another place in the world, one has to prefix it with+1
, so that it reads+16044011234
. In other regions in the world,6044011234
may reach a different phone in that region. Setting the default region allows interpreting6044011234
as+16044011234
, uniquely identifying the phone number.To implement your use case, you could create a validator that checks the phone number country code, e.g.: