def customer_registration(request): if request.user.is_authenticated(): return HttpResponseRedirect("customer/profile/") if request.method == "POST": form = RegistrationForm(request.POST) if form.is_valid(): clean_user = form.clean() user = User.objects.create_user( username=clean_user["username"], email=clean_user["email"], password=clean_user["password"] ) user.is_active = False user.save() customer = user.get_profile() customer.save() return HttpResponseRedirect("customer/profile") else: return render_to_response( "customer/register.html", {"form": form}, context_instance=RequestContext(request) ) else: """ user is not submitting the form, show them a blank registration form """ form = RegistrationForm() context = {"form": form} return render_to_response("customer/register.html", context, context_instance=RequestContext(request))