コード例 #1
0
ファイル: views.py プロジェクト: nagrajan/exper
def register_user(request):
    if request.method == 'POST':
        form = MyUserCreationForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/accounts/register_success')

    args = {}
    args.update(csrf(request))
    args['form'] = MyUserCreationForm()
    return render_to_response('register.html', args)
コード例 #2
0
ファイル: views.py プロジェクト: joubo/Django-Tienda
def userRegister(request):
	if request.method == 'POST':
		form = MyUserCreationForm(data=request.POST)
		if form.is_valid():
			form.save()
			return redirect('/usuarios/login')
	else:
		form = MyUserCreationForm()

	context = {'form' : form}
	return render(request, "usuarios/register.html", context)
コード例 #3
0
ファイル: views.py プロジェクト: MechanisM/gphblog
def create_new_user(request):
    """
    View to create a new user
    """
    if request.method == 'POST':
        form = MyUserCreationForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect("/accounts/login/")
        else:
            return render_to_response("auth/create.html", {'form': form, })
    else:
        form = MyUserCreationForm()
    return render_to_response("auth/create.html", {'form': form, }, RequestContext(request))
コード例 #4
0
ファイル: views.py プロジェクト: DSI-ETSII-ULL/2014-Truekejob
def signup(request):
    if request.method == 'POST':
        username = request.POST['username']
        password = request.POST['password1']
        form = MyUserCreationForm(request.POST)
        if form.is_valid():
            form.save()
            user = authenticate(username=username, password=password)
            auth_login(request, user)
            messages.success(request, 'Profile successfully created.')
            return redirect(reverse('home'))
    else:
        form = MyUserCreationForm()

    return render(request, 'accounts/signup.html', {'form': form})
コード例 #5
0
ファイル: views.py プロジェクト: biddy1618/customBlog
def register(request):
    if request.method == 'POST':
        form = MyUserCreationForm(request.POST)
        #pdb.set_trace()
        if form.is_valid():
            form.save()
            return render(
                request, 'login.html', {
                    'message':
                    'You are successfully registered. Log in now, please.',
                    'request': request
                })
        else:
            return render(
                request, 'register.html', {
                    'message': 'Please, enter the correct input!',
                    'request': request,
                    'form': form,
                })
コード例 #6
0
def signup(request):
    if request.method == 'POST':
        username = request.POST['username']
        password = request.POST['password1']
        form = MyUserCreationForm(request.POST)
        if form.is_valid():
            form.save()
            user = authenticate(username=username, password=password)
            auth_login(request, user)
            messages.success(request, 'Profile successfully created.')
            return redirect(reverse('home'))
    else:
        form = MyUserCreationForm()

    return render(request, 'accounts/signup.html', {'form': form})
コード例 #7
0
ファイル: views.py プロジェクト: kodiers/deploy
def reg_user(request):
    if request.method == 'POST':
        form = MyUserCreationForm(request.POST)
        if form.is_valid():
            username = form.clean_username()
            form.save()
            # Edit zone file
            change_zone_file(FILEPATH, username)    # call function to change dns zones file
            return HttpResponseRedirect("/regsuccess/")
    else:
        form = MyUserCreationForm()
    return render_to_response("registration.html", {"form":form}, context_instance=RequestContext(request))
コード例 #8
0
ファイル: views.py プロジェクト: WBowam/0kdr-myprofile-
def register(request):

    if request.method == 'POST':
        form = MyUserCreationForm(request.POST)
        if form.is_valid():
            new_user = form.save()
            return HttpResponseRedirect("/accounts/login/")
    else:
        form = MyUserCreationForm()
    return render_to_response("accounts/register.html", {
        'form': form,
    },
                              context_instance=RequestContext(request))
コード例 #9
0
ファイル: views.py プロジェクト: TonyL888/gphblog
def create_new_user(request):
    """
    View to create a new user
    """
    if request.method == 'POST':
        form = MyUserCreationForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect("/accounts/login/")
        else:
            return render_to_response("auth/create.html", {
                'form': form,
            })
    else:
        form = MyUserCreationForm()
    return render_to_response("auth/create.html", {
        'form': form,
    }, RequestContext(request))