Python 用户注册时的Django IntegrityError
我尝试使用django allauth扩展用户配置文件时出错Python 用户注册时的Django IntegrityError,python,django,django-allauth,django-1.6,Python,Django,Django Allauth,Django 1.6,我尝试使用django allauth扩展用户配置文件时出错 Exception Type: IntegrityError at /accounts/signup/ Exception Value: workerapp_userprofile.user_id may not be NULL 这是django项目workerapp应用程序中的my models.py,我要求提供两个附加字段以及其他注册信息 from django.db import models from django.cont
Exception Type: IntegrityError at /accounts/signup/
Exception Value: workerapp_userprofile.user_id may not be NULL
这是django项目workerapp应用程序中的my 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
我的用户正在正确保存,我可以在管理员中看到,这只是在注册过程中显示此错误。您如何创建用户?我正在使用django allauth应用程序来处理用户注册。它创建自己的表单和模板,我所要做的就是在URL.py中添加(r“^accounts/”,include('allauth.url')),您是否使用
post\u save.connect
信号?再见,谢谢。我尝试使用post_save.connect,但它仍然显示相同的错误。这是我的新型号