コード例 #1
0
ファイル: views.py プロジェクト: mrpindo/openshift-estore
def signup(request):
    if request.method == "POST":
        form = SignUpForm(request.POST)
        if form.is_valid():
            instance = form.save()
            # Generate and send activation email
            _send_activation_email(instance)
            return HttpResponseRedirect("/accounts/signup/checkyouremail")
    else:
        form = SignUpForm()
    return render_to_response("myauth/signup_form.html", {"form": form}, context_instance=RequestContext(request))
コード例 #2
0
ファイル: views.py プロジェクト: hxer/Demo
def signup(request):
    if request.method == 'POST':
        form = SignUpForm(request.POST)
        if not form.is_valid():
            return render(request, 'myauth/signup.html', {'form': form})
        else:
            username = form.cleaned_data.get('username')
            email = form.cleaned_data.get('email')
            password = form.cleaned_data.get('password')
            User.objects.create_user(username=username, email=email, password=password)
            user = authenticate(username=username, password=password)
            login(request, user)
            return redirect('/')
    else:
        return render(request, 'myauth/signup.html', {'form': SignUpForm()})