Giter Club home page Giter Club logo

Comments (3)

francoisfreitag avatar francoisfreitag commented on August 17, 2024

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.

kmartynski avatar kmartynski commented on August 17, 2024

@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.

francoisfreitag avatar francoisfreitag commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.