ich verwende,Integritätsfehler nach Anmeldung bei der Registrierung redux für Django 1.8
Django == 1.8 django-registration-redux == 1.1
Nach dem Anmeldeformular einreichen Ich erhalte die Integrität Error .
Ich bin tatsächlich ein Tutorial folgen.
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
Sie bitte die Zurückverfolgungs unter
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/accounts/register/
Django Version: 1.8
Python Version: 3.4.0
Installed Applications:
('django.contrib.admin',
'registration',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'API')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware')
Traceback:
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
132. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/views/generic/base.py" in view
71. return self.dispatch(request, *args, **kwargs)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/registration/views.py" in dispatch
79. return super(RegistrationView, self).dispatch(request, *args, **kwargs)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/views/generic/base.py" in dispatch
89. return handler(request, *args, **kwargs)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/registration/views.py" in post
35. return self.form_valid(request, form)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/registration/views.py" in form_valid
82. new_user = self.register(request, **form.cleaned_data)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/registration/backends/default/views.py" in register
92. request=request,
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/registration/models.py" in create_inactive_user
91. registration_profile = self.create_profile(new_user)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/registration/models.py" in create_profile
115. activation_key=activation_key)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/models/manager.py" in manager_method
127. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/models/query.py" in create
348. obj.save(force_insert=True, using=self.db)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/models/base.py" in save
710. force_update=force_update, update_fields=update_fields)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/models/base.py" in save_base
738. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/models/base.py" in _save_table
822. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/models/base.py" in _do_insert
861. using=using, raw=raw)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/models/manager.py" in manager_method
127. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/models/query.py" in _insert
920. return query.get_compiler(using=using).execute_sql(return_id)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/models/sql/compiler.py" in execute_sql
963. cursor.execute(sql, params)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/backends/utils.py" in execute
79. return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/utils.py" in __exit__
97. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/utils/six.py" in reraise
658. raise value.with_traceback(tb)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
File "/home/bhanu_prakash/Desktop/ENV1/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py" in execute
318. return Database.Cursor.execute(self, query, params)
Exception Type: IntegrityError at /accounts/register/
Exception Value: NOT NULL constraint failed: registration_registrationprofile.activated
Wahrscheinlich einige db Ausgabe überprüfen.
Modelle Code als Referenz
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):
...
Sie haben nicht genügend Code gezeigt, um das Problem zu erklären. Welches Tutorial folgen Sie? Die neueste Version von django-registration-redux ist 1.4. Sie könnten versuchen, zu aktualisieren, um zu sehen, ob es ein Fehler mit 1.1 ist. – Alasdair
@Alasdair Django von Grund auf von Stein River .. Redux-Versionen über 1.1 müssen base.html in den Vorlagen vorhanden sein. Ich benutze sie jetzt nicht (laut Anleitung). Ich bin ein Neuling für Django und auch Webdev. Welchen Code soll ich einfügen? Ansichten, Formulare? –
Idealerweise möchten Sie genügend Code einfügen, damit andere das Problem erneut erstellen können. Siehe [MCVE]. – Alasdair