Sto provando ad usare la registrazione django nel mio semplice progetto.django-registration (1048, "Column 'last_login' non può essere nullo")
settings.py
# DJANGO REGISTRATION
ACCOUNT_ACTIVATION_DAYS = 7
AUTH_USER_EMAIL_UNIQUE = True
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
DEFAULT_FROM_EMAIL = '[email protected]'
urls.py
url(r'^accounts/', include('registration.backends.hmac.urls')),
modello di iscrizione:
{% extends "index.html" %}
{% block content %}
<h1>Registration</h1>
<form method="post" action="">
{% csrf_token %}
<dl class="register">
{% for field in form %}
<dt>{{ field.label_tag }}</dt>
<dd class="clearfix">{{ field }}
{% if field.help_text %}<div class="clearfix">{{ field.help_text }}</div>{% endif %}
{% if field.errors %}<div class="myerrors clearfix">{{ field.errors }}</div>{% endif %}
</dd>
{% endfor %}
</dl>
<input type="submit" value="Sign Up" class="clearfix">
</form>
{% endblock %}
Quando ho intenzione di registrare un nuovo utente, ottengo un errore:
Django Version: 1.9c1
Exception Type: IntegrityError
Exception Value: (1048, "Column 'last_login' cannot be null")
Non uso il modello 'CustomUser'.
Domanda correlata (forse un duplicato): [L'aggiornamento da Django 1.6 (con sud) a 1.8 non modifica 'last_login' nella tabella utente] (http://stackoverflow.com/questions/29913612/upgrading-from -django-1-6-con-sud-to-1-8-doesnt-modify-last-login-on-the) –
@ try-catch-finally quella domanda è un po 'diversa, perché quell'utente aveva un utente personalizzato modello. – Alasdair