Django 1.11 升级 - 对象没有属性 'password'

Django 1.11 upgrade - object has no attribute 'password'

我在 Django 1.7 上 运行 一直很好。我正在尝试升级到 1.11。

我在 1.11 上遇到以下错误,我似乎找不到问题所在。

这是有问题的代码:

class Profile(models.Model):
    profile_id = models.CharField(max_length=50, null=True, unique=True, db_index=True)
    pet_shop_customer_id = models.CharField(max_length=40)
    django_user = models.OneToOneField(User, to_field='username', parent_link=True, null=True,
                                       db_column="django_username", default=None, db_index=True, db_constraint=False)

问题是当我调用:

profile = Profile.objects.get(profile_id='x')  # pulls a valid profile
print profile.django_user

我收到这个错误:

异常值:

'Profile' object has no attribute 'password'

Exception Location:     /Users/../lib/python2.7/site-packages/django/db/models/fields/related_descriptors.py in <dictcomp>, line 291

正如@adrien 在评论中提到的那样,这就是问题所在。我不得不删除一对一字段中的 parent_link=True 到用户。