Django 1.8注册后注册反复发现完整性错误

2024-04-28 14:38:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用

Django==1.8 django registration redux==1.1

提交注册表后,我收到完整性错误。在

我实际上是在听教程。在

IntegrityError at /accounts/register/
NOT NULL constraint failed: registration_registrationprofile.activated
Request Method: POST
Request URL:    http://127.0.0.1:8000/accounts/register/
Django Version: 1.8
Exception Type: IntegrityError
Exception Value:    
NOT NULL constraint failed: registration_registrationprofile.activated
Exception Location: /home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py in execute, line 318
Python Executable:  /home/bhanu_prakash/Desktop/ENV1/bin/python
Python Version: 3.4.0
Python Path:    
['/home/bhanu_prakash/Desktop/ENV1/automation',
 '/home/bhanu_prakash/Desktop/ENV1/lib/python3.4',
 '/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/plat-x86_64-linux-gnu',
 '/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/lib-dynload',
 '/usr/lib/python3.4',
 '/usr/lib/python3.4/plat-x86_64-linux-gnu',
 '/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages']
Server time:    Tue, 12 Apr 2016 12:14:10 +0000

请检查下面的回溯

^{pr2}$

可能是数据库问题。在

参考型号代码

class RegistrationProfile(models.Model):

    ACTIVATED = "ALREADY_ACTIVATED"

    user = models.ForeignKey(UserModelString(),unique=True, verbose_name=_('user'))
    activation_key = models.CharField(_('activation key'), max_length=40)

    objects = RegistrationManager()

    class Meta:
        verbose_name = _('registration profile')
        verbose_name_plural = _('registration profiles')

    def __str__(self):
        ...

Tags: djangonamehomeverbosemodelslibexceptionregistration
1条回答
网友
1楼 · 发布于 2024-04-28 14:38:18

尝试删除数据库sqlite3然后再次运行./manage.py migrate。您使用的是django-registration-redux==1.1,表是用1.2创建的。在

相关问题 更多 >