hash - Django admin interface: Invalid password format or unknown hashing algorithm -


i've made register , login function saves user data database using django user object. when register user, password linked user doesn't hashed properly. means have error in django admin interface: "invalid password format or unknown hashing algorithm.". i've made sure use set_password.

models.py

    django.db import models django.contrib.auth.models import user  class user_information(models.model):     # links userprofile user model instance     user = models.onetoonefield(user)      # override __unicode__() method return username     def __unicode__(self):         return self.username 

forms.py

       django import forms     django.contrib.auth.models import user     authentication.models import user_information      class user_form(forms.modelform):         # using passwordinput widget hide entered content of password field         password = forms.charfield(widget=forms.passwordinput())          # define nested class. default fields can edited here, if wish exclude something.         class meta:             model = user             fields = ('username', 'first_name', 'last_name', 'email', 'password') 

views.py

def register(request):     context = requestcontext(request)     # checks if registration successful. changes true if case     # processing form data.     if request.method == 'post':         user_form = user_form(data=request.post)         # if form valid.         if user_form.is_valid():             # saves user's data database.             user = user_form.save()             # hash password , updates user object.             user.set_password(user.password)             user.save             # tell template registration successful             messages.success(request, 'you registered successfully')         else:             print user_form.errors     else:         user_form = user_form()      return render_to_response(         'authentication/register.html',         {'user_form': user_form},         context) 

thanks in advance.

it possible extend predefined form django.contrib.auth.forms.usercreationform needs.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -