模块'django.db.models'没有属性'OnetoOneField'

我正在遵循Django教程,该教程在models.py文件中使用models.OnetoOneFiled()。当我尝试实现相同的功能时,我得到了他的错误:

AttributeError:模块'django.db.models'没有属性'OnetoOneField'

我已添加此行,如先前的一些答案所建议,但没有运气。

from django.contrib.auth.models import User
from django.db import models

# Create your models here.
class UserProfileInfo(models.Model):

    user = models.OnetoOneField(User,on_delete=models.CASCADE,primary_key=True,)
    # additional 

    portfolio_site = models.URLField(blank=True)
    profile_pic = models.ImageField(upload_to='profile_pics',blank=True)

    def __str__(self):
        return self.user.username

如果成功,我应该可以迁移

shong29 回答:模块'django.db.models'没有属性'OnetoOneField'

它的OneToOneField不是OnetoOneField

本文链接:https://www.f2er.com/3151049.html

大家都在问