我已经安装了
pip install django-phonenumber-field
pip安装电话号码
与pipenv。但是当我要在我的models.py文件中使用它时 它说
Cannot find reference 'PhoneNumberField' in '__init__.py'
在PyCharm中
from django.db import models
from phonenumber_field.modelfields import PhoneNumberField
# Create your models here.
from project_apps.core.models import TimestampedModel
class Profile(TimestampedModel):
user = models.OneToOneField(
'authentication.User',
on_delete=models.CASCADE
)
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
phone = models.PhoneNumberField()
def __str__(self):
return self.user.email
我已从modelfield导入PhoneNumberField。有帮助吗?