# Path: accounts/forms.py
# class RegistrationForm(UserCreationForm):
#     pass


from django.contrib.auth import authenticate, login
from django.core.urlresolvers import reverse
from django.shortcuts import render, redirect
from django.views.generic.edit import FormView
from accounts.forms import RegistrationForm



class RegistrationView(FormView):

    template_name = 'registration/register.html'
    form_class = RegistrationForm

    def form_valid(self, form):
        form.save()

        user = authenticate(
                username=form.cleaned_data['username'],

# Path: accounts/forms.py
# class RegistrationForm(UserCreationForm):
#     pass


# Path: accounts/views.py
from django.contrib.auth import authenticate, login
from django.core.urlresolvers import reverse
from django.shortcuts import render, redirect
from django.views.generic.edit import FormView
from accounts.forms import RegistrationForm




class RegistrationView(FormView):

    template_name = 'registration/register.html'
    form_class = RegistrationForm

    def form_valid(self, form):
        form.save()

        user = authenticate(
                username=form.cleaned_data['username'],

                password=form.cleaned_data['password1'])