Comments (3)
There is no such option, because a regional phone number can be valid in different region, resulting in ambiguity.
I would rather recommend asking for phone numbers with a country selector (e.g. phonenumber_field.widgets.PhoneNumberPrefixWidget
), or a phone number in an international format (region=None
).
from django-phonenumber-field.
@francoisfreitag thank you for rapid response.
So if I understand correctly by the second recommendation I should only stick to:
PHONENUMBER_DEFAULT_FORMAT = "INTERNATIONAL"
class Client(models.Model):
phone = PhoneNumberField(region=None)
And remove
PHONENUMBER_DEFAULT_REGION = "PL"
Is that right? :)
from django-phonenumber-field.
Yes, if you don’t want to interpret national phone numbers in your region, leaving PHONENUMBER_DEFAULT_REGION
unspecified is the way to go. The system will then only accept phone numbers in an international format. To facilitate data entry for humans, you can use (or take inspiration from) the PhoneNumberPrefixWidget.
As for the format, INTERNATIONAL
is a good choice, it allows for international phone numbers, including phone extensions. https://django-phonenumber-field.readthedocs.io/en/stable/reference.html#phonenumber-db-format
from django-phonenumber-field.
Related Issues (20)
- Remove check for .mo files
- Form field does not auto-detect region from international number HOT 2
- Italian translations incomplete HOT 5
- Usage with django ninja HOT 5
- Make the model/formfield region kwarg the default selection in PhoneNumberPrefixWidget HOT 1
- Validation error with wrong locale HOT 1
- bug in python 3.10 HOT 1
- Extension information is lost during serialization HOT 8
- [Question] Best way to generae US phonenumber for testing HOT 1
- validate_international_phonenumber does not validate correctly at some cases HOT 1
- Pydantic Serialization HOT 1
- Use Django's "normal" validation, not hardcoded in __init__() HOT 9
- Turkmenistan phone numbers has been updated HOT 1
- The valid phonenumber is not accepted by this package HOT 1
- 0493 prefix invalid numbet Australia HOT 1
- Handling of special (non-geo) phone numbers
- python-phonenumbers should be a requirement HOT 1
- django-phonenumber-field[phonenumberslite] requires phonenumbers on migration HOT 1
- Support numbers as phone numbers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-phonenumber-field.