Exemplo n.º 1
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 FROM INVSALID')

    return render(request, 'users.html', {'form': form})
def users(request):
    # user_list = User.objects.order_by('LastName')
    # user_dict = {'users': user_list}
    # return render(request, 'AppTwo/user.html', context=user_dict)
    f = NewUserForm()
    if request.method == 'POST':
        f = NewUserForm(request.POST)

        if f.is_valid():
            f.save(commit=True)
            return index(request)
        else:
            print('ERROR FOR IS INVALID')

    return render(request, 'AppTwo/users.html', {'form': f})
Exemplo n.º 3
0
def signup(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 INVALID")

	return render(request,"AppTwo/signup.html",{'form':form})
Exemplo n.º 4
0
def user(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/user.html', {'form': form})
Exemplo n.º 5
0
def users(request):
    # user_list = User.objects.order_by('FirstName')
    # user_dict = {'users':user_list}
    # return render(request,'AppTwo/users.html',context=user_dict)

    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 Invalid")
    return render(request, 'AppTwo/users.html', {'form': form})
Exemplo n.º 6
0
def users(request):
    form = NewUserForm()

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

        # checks if input information was entered in correctly
        if form.is_valid():
            form.save(commit=True)
            # return the index view of the request/ take you back to the homepage
            return index(request)
        else:
            print('ERROR FORM INVALAD')

    return render(request, 'AppTwo/users.html', {'form': form})
Exemplo n.º 7
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 invalid!')

    return render(request, 'AppTwo/users.html', {'form': form})
Exemplo n.º 8
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) #TODO
        else:
            print('ERROR COUNTERED !')

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

    """
Exemplo n.º 9
0
def users(request):
    form = NewUserForm()

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

        if form.is_valid():
            form.save(commit=True)  # saves to the db
            return index(request)  # redirect to index page
            # print("first:" + form.cleaned_data['first_name'])
            # print("Last:" + form.cleaned_data['last_name'])
            # print("email:" + form.cleaned_data['email'])
        else:
            print("ERROR FORM INVALID")

    return render(request, 'AppTwo/model_form.html', {'form': form})
Exemplo n.º 10
0
def show_user_info(request):
    """ user_list = User.objects.order_by('first_name')
    user_dict = {'userinfo': user_list}
    return render(request, "AppTwo/showuserinfo.html", context=user_dict) """

    form = NewUserForm()
    if request.method == "POST":
        form = NewUserForm(request.POST)
        if form.is_valid():
            
            form.save(commit=True)

            return default(request)
        else:
            print('Error form invalid')
    return render(request, "AppTwo/showuserinfo.html", context={'form': form})
Exemplo n.º 11
0
def users(request):

    # user_list=User.objects.order_by("first_name")
    # user_dict={"user":user_list}
    # return render(request,'AppTwo/user.html',context=user_dict)
    form = NewUserForm()

    if request.method == "POST":  #Someone hit submit and sends the information back
        form = NewUserForm(request.POST)

        if form.is_valid():
            form.save(commit=True)
            return index(request)  # Take back to the home page
        else:
            print('ERROR FORM INVALID')
    return render(request, 'AppTwo/user.html', {'form': form})
Exemplo n.º 12
0
def users(request):
    #    users = User.objects.order_by('email')
    #    user_dict = {'user_records' : users}
    #    return render(request, 'AppTwo/users.html', context=user_dict)
    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 INVALID')

    return render(request, 'AppTwo/users.html', {'form': form})
Exemplo n.º 13
0
def users(request):
    form = NewUserForm()

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

        if form.is_valid():
            #DO SOMETHING LANGUAGE_CODE
            form.save(commit=True)
            return index(request)
        else:
            print('ERROR FORM INVALID')

    return render(request, 'AppTwo/user.html', {'form': form})