line 53, in from phonenumber_field.modelfields import PhoneNumberField
ModuleNotFoundError: No module named 'phonenumber_field'
CodePudding user response:
For You
pip3 install django-phonenumber-field[phonenumbers]
Example
Installation
For python
and python2
pip install django-phonenumber-field[phonenumbers]
As an alternative to the phonenumbers package, it is possible to install the phonenumberslite package which has a lower memory footprint.
pip install django-phonenumber-field[phonenumberslite]
Basic usage First, add phonenumber_field to the list of the installed apps in your settings.py file:
INSTALLED_APPS = [
...
'phonenumber_field',
...
]
Then, you can use it like any regular model field:
from phonenumber_field.modelfields import PhoneNumberField
class MyModel(models.Model):
name = models.CharField(max_length=255)
phone_number = PhoneNumberField()
fax_number = PhoneNumberField(blank=True)