Reputation: 3779
I'm switching from using the default registration model to a custom model (to drop username and just authenticate with email address). An existing user can login, but creating a new user fails silently now. I call url 'registration_register'
, I get the user create form I expect, I fill it in and click the submit button, and...the form redisplays with email but not password, no error, no user creation.
{% extends "..." %}
{% block content %}
<form method="post" action="{% url 'registration_register' %}">
{% csrf_token %}
{{ form.email.errors }}
<label for="{{ form.email.id_for_label }}">mail</label> {{ form.email }}
<br>
{{ form.password1.errors }}
<label for="{{ form.password1.id_for_label }}">password</label> {{ form.password1 }}
<br>
{{ form.password2.errors }}
<label for="{{ form.password2.id_for_label }}">password</label> {{ form.password2 }}
<br>
<input type="submit" value="Create" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
{% endblock %}
I pip install django-custom-user and make the changes recommended here -- adding to INSTALLED_APPS, db sync (in fact, it's a new project, so db delete and create), and the couple code changes to use it. I've left 'registration' in INSTALLED_APPS.
Django (1.7.6)
django-custom-user (0.5)
My urls.py
still points to registration.backends.default.urls
.
url(r'^accounts/', include('registration.backends.default.urls')),
Upvotes: 0
Views: 101
Reputation: 2971
Well the problem you face is that django-registration
expects a username as well as a password and an email address. As you can see in the source code of django-registration
If I were you I would simply create a simple form and use a FormView from django. After, in order to match django-registration you could do more research and try to fit django-registration with django-custom-user.
It could be that you create a class that inherits django-custom-user, or that you change the form or anything like that. Otherwise you could even fork django-registration and update it according to django-custom-user and then use it for your project and make it available on github as django-registration-custom-user
Upvotes: 1
Reputation: 2971
Have you tried python manage.py makemigrations
and python manage.py migrate
?
Also try displaying the form as form.as_p
in order to get all fields and all errors displayed automatically. Forget about CSS for now.
Also what package is registration.backends.default.urls
?
Because it is not django-custom-user
I hope this helps
Upvotes: 0