for view-based classes, here was the code that worked for me (django 1.7)
from django.contrib.auth import authenticate, login
from django.contrib.auth.forms import UserCreationForm
from django.views.generic import FormView
class SignUp(FormView):
template_name = 'signup.html'
form_class = UserCreationForm
success_url='/account'
def form_valid(self, form):
form.save()
username = self.request.POST['username']
password = self.request.POST['password1']
user = authenticate(username=username, password=password)
login(self.request, user)
return super(SignUp, self).form_valid(form)
source
share