I’m trying to use the PhoneNumberField and PhoneNumber classes from the phonenumber_field package in my Django project. I have imported the necessary modules as follows:
from phonenumber_field.modelfields import PhoneNumberField
from phonenumber_field.phonenumber import PhoneNumber
However, when I try to use these classes in my code, I’m encountering an error. Here’s the code snippet where the error occurs:
from phonenumber_field.modelfields import PhoneNumberField
from phonenumber_field.phonenumber import PhoneNumber`
The error message I’m receiving is: AttributeError: module ‘phonenumber_field.modelfields’ has no attribute ‘PhoneNumberField’
I have already installed the phonenumber_field package and verified that it is up to date. Can someone please guide me on the correct usage of these classes and help me resolve this issue?”
I have already installed the phonenumber_field package and verified that it is up to date
Yared Birihanu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.