当我尝试使用django-allauth
扩展用户配置文件时出现错误Exception Type: IntegrityError at /accounts/signup/
Exception Value: workerapp_userprofile.user_id may not be NULL
这是我在我的django项目的workerapp应用程序中的models.py,我要求另外两个字段以及其他注册信息。
from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
# This line is required. Links UserProfile to a User model instance.
user = models.OneToOneField(User, unique=True)
# The additional attributes we wish to include.
website = models.URLField(blank=True)
picture = models.ImageField(upload_to='profile_images', blank=True)
# Override the __unicode__() method to return out something meaningful!
def __unicode__(self):
return self.user.username
我的用户正确保存,我可以在管理员中看到,这只是在注册过程中显示此错误。