コード例 #1
0
ファイル: views.py プロジェクト: Gliman/BlogProject
def users(request):
    form = NewUserForm()
    if request.method == "POST":
        form = NewUserForm(request.POST)
        if form.is_valid():
            form.save(commit=True)
            return index(request)
        else:
            print('Error from invalid')

    return render(request, 'apptwo/users.html', {'form': form})
コード例 #2
0
def users(request):
    #this view gets the model, transforms it into a dictionary, then displays it
    form = NewUserForm()
    if request.method == 'POST':
        form = NewUserForm(request.POST)
        if form.is_valid():
            form.save(commit=True)
            return index(request)
        else:
            print('Form invalid')

    return render(request,'apptwo/users.html',{'form':form})
コード例 #3
0
def signup_form(request):
    form = NewUserForm()
    if request.method == 'POST':
        form = NewUserForm(request.POST)

        if form.is_valid():
            form.save(commit=True)
            return home(request)
        else:
            print('ERROR! FORM INVALID')

    return render(request, 'apptwo/signup.html', {'form': form})
コード例 #4
0
def users(request):
    form = NewUserForm()

    if request.method == "POST":
        form = NewUserForm(request.POST)

        if form.is_valid():
            form.save(commit=True)
            return index(request)
        else:
            print("ERROR FORM IS INVALID")

    return render(request, 'apptwo/users.html', {'form': form})
コード例 #5
0
def users(request):
    form = NewUserForm()

    if request.method == 'POST':
        form = NewUserForm(request.POST)

        if form.is_valid():
            print("valid hu")
            form.save(commit=True)
            return render(request, 'apptwo/index.html')
        else:
            print("Error!!Form is invalid")
    return render(request, 'apptwo/userinfo.html', {'form': form})
コード例 #6
0
def users(request):

    form = NewUserForm()

    if request.method == 'POST':
        form = NewUserForm(request.POST)

        if form.is_valid():
            form.save(commit=True)
            return index(request)
        else:
            print('Invalid Form')

    return render(request, 'apptwo/users.html', context={'form': form})
コード例 #7
0
def user(request):
    # userlist = users.objects.order_by('firstname')
    # userdict = {'users':userlist}
    # return render(request,'apptwo/users.html', context=userdict)
    form = NewUserForm()
    if request.method == 'POST':
        form = NewUserForm(request.POST)

        if form.is_valid():
            form.save(commit=True)
            messages.success(request,
                             'We have recieved your Data! Thanks for Trying.')
            return HttpResponseRedirect(reverse('index'))
        else:
            print('ERROR FORM INVALID.')

    return render(request, 'apptwo/users.html', {'form': form})