示例#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
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
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
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
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
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))