예제 #1
0
def Signup(request):
    if request.method == 'POST':
        form = SignupForm(request.POST)
        if form.is_valid():
            user = form.save()
            # user.refresh_from_db()
            username = form.cleaned_data.get('username')
            password = form.cleaned_data.get('password')
            user.profile.email = form.cleaned_data.get('email')
            user.profile.first_name = form.cleaned_data.get('first_name')
            user.profile.last_name = form.cleaned_data.get('last_name')
            user.set_password(password)
            user.save()

            user = authenticate(username=user.username, password=password)

            return redirect('authy:login')
    else:
        form = SignupForm()

    context = {
        'form': form,
    }

    return render(request, 'registration/signup.html', context)
예제 #2
0
def Signup(request):
	if request.method == 'POST':
		form = SignupForm(request.POST)
		if form.is_valid():
			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)
			return redirect('home')
	else:
		form = SignupForm()
	
	context = {
		'form':form,
	}

	return render(request, 'signup.html', context)
예제 #3
0
def sign_up(request):
    if request.method == 'POST':
        form = SignupForm(request.POST)
        if form.is_valid():
            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)
            return redirect('edit_profile')
    else:
        form = SignupForm()

    context = {
        'form': form,
    }
    template = loader.get_template('signup.html')
    return HttpResponse(template.render(context, request))
예제 #4
0
def Signup(request):
    if request.method == 'POST':
        form = SignupForm(request.POST)
        if form.is_valid():
            username = form.cleaned_data.get('username')
            email = form.cleaned_data.get('email')
            first_name = form.cleaned_data.get('first_name')
            last_name = form.cleaned_data.get('last_name')
            password = form.cleaned_data.get('password')
            User.objects.create_user(username=username,
                                     email=email,
                                     first_name=first_name,
                                     last_name=last_name,
                                     password=password)

            return redirect('login')

    else:
        form = SignupForm()

    context = {'form': form}

    return render(request, 'registration/signup.html', context)