[Python] What's the best way to store a phone number in Django models?

Discussão em 'Python' iniciado por Stack, Abril 25, 2025.

  1. Stack

    Stack Membro Participativo

    I am storing a phone number in model like this:

    phone_number = models.CharField(max_length=12)


    The user would enter a phone number and I would use the phone number for SMS authentication. This application would be used globally. So I would also need a country code. Is CharField a good way to store a phone number? And, how do I validate the phone number?

    Continue reading...

Compartilhe esta Página