I have problem when I want to use simple CreateView for creating new user. Everything is ok, I can create user, but when I want logging with new created user, I cant do it.
I got this type of my password in admin:
Invalid password format or unknown hashing algorithm.
Raw passwords are not stored, so there is no way to see this user's password, but you can change the password using this form.
This is my code:
model.py
from django.db import models
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import AbstractUser, UserManager
class CustomUser(AbstractUser):
"""app setting of user"""
url = models.URLField(u'Site URL', max_length=100, null=True, unique=True)
admin.site.register(CustomUser, UserAdmin)
urls.py
from django.conf.urls.defaults import *
from models import CustomUser
from django.views.generic import CreateView
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
urlpatterns = patterns('',
url(r'^create_user/$',(CreateView.as_view(model=CustomUser, get_success_url =lambda: reverse('create_user'),
template_name="create_user.html")), name='create_user'),
)
create_user.html
<div title="Create Form " id="/create_user">
<p> <b>Create account:</b> </p>
{{ form.errors }}
<form action="" method="post" id="id_create_user" >
{% csrf_token %}
{{ form.as_p }}
<div>
<input type="submit" value="Create account" style="">
</div>
</form>
</div>
And after creating user, I have to log in as admin and change this password, and after that everything will be ok.
What should I do to solve the problem?
Thank you!