def register_page(request): if request.method == "POST": form = register_form(request.POST) if form.is_valid(): user = User.objects.create_user(username=form.cleaned_data['username'], password=form.cleaned_data['password'], email=form.cleaned_data['email']) user.first_name = form.cleaned_data['first_name'] user.last_name = form.cleaned_data['last_name'] user.save() prof = Profile.objects.create(user=user, website_blog='', location='', about='') prof.save() return HttpResponseRedirect('/login/') else: form = register_form() variables = RequestContext(request, {'form': form}) return render_to_response('registration/register.html', variables)
def register_page(request): if request.method == "POST": form = register_form(request.POST) if form.is_valid(): user = User.objects.create_user(username=form.cleaned_data['username'], password=form.cleaned_data['password2'], email=form.cleaned_data['email']) user.first_name = form.cleaned_data['first_name'] user.last_name = form.cleaned_data['last_name'] user.save() prof = Profile.objects.create(user=user, website_blog='', location='', about='') prof.save() send_mail('[Ewikis] Welcome to Ewikis!', 'Thank you for choosing our services.', '*****@*****.**', [user.email], fail_silently=False) return direct_to_template(request, 'registration/register_success.html') else: form = register_form() variables = RequestContext(request, {'form': form}) return render_to_response('registration/register.html', variables)