from django.shortcuts import render # Create your views here. #views.py from login.forms import * from django.contrib.auth.decorators import login_required from django.contrib.auth import logout from django.views.decorators.csrf import csrf_protect from django.shortcuts import render_to_response from django.http import HttpResponseRedirect from django.template import RequestContext from dbconnection import DBConnection from login.forms import PostForm connection = DBConnection() val = connection.select() @csrf_protect def register(request): if request.method == 'POST': form = RegistrationForm(request.POST) if form.is_valid(): user = User.objects.create_user( username=form.cleaned_data['username'], password=form.cleaned_data['password1'], email=form.cleaned_data['email']) return HttpResponseRedirect('/register/success/') else: form = RegistrationForm() variables = RequestContext(request, {'form': form})