changeset 160:a5547f079190

Fix bug in registration django-registration's RegistrationForm isn't a ModelForm, it's just a Form, so there's no save method. Have to create the account manually.
author dellsystem <ilostwaldo@gmail.com>
date Mon, 15 Oct 2012 02:24:01 -0400
parents aa9a594334c7
children 10eebb5a1c68
files views.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/views.py
+++ b/views.py
@@ -1,4 +1,5 @@
 from django.contrib.auth import login, authenticate
+from django.contrib.auth.models import User
 from django.contrib.auth.forms import AuthenticationForm
 from django.shortcuts import render, redirect
 from django.core.urlresolvers import reverse
@@ -45,7 +46,12 @@
             form = RegistrationForm(request.POST)
 
             if form.is_valid():
-                user = form.save()
+                username = form.cleaned_data['username']
+                email = form.cleaned_data['email']
+                password = form.cleaned_data['password1']
+
+                User.objects.create_user(username, email, password)
+                user = authenticate(username=username, password=password)
                 login(request, user)
                 return redirect(next_url)
         else: