Ejemplo n.º 1
0
def forms_page(request):
    form = forms.FormName()

    if request.method == 'POST':
        form = forms.FormName(request.POST)
        if form.is_valid():
            print('Name: '+form.cleaned_data['first_name'])
            print('Email: '+form.cleaned_data['email'])
            form.save(commit=True)
            return index(request)
    return render(request, 'AppTwo/forms.html.', {'forms': form})
Ejemplo n.º 2
0
def form_name_view(request):
    form = forms.FormName()
    if request.method == 'POST':
        form = forms.FormName(request.POST)

        if form.is_valid():
            print('Validation Success!')
            print('Name: ' + form.cleaned_data['name'])
            print('Email: ' + form.cleaned_data['email'])
            print('Text: ' + form.cleaned_data['text'])
    return render(request, 'basicapp/form_page.html', {'form': form})
Ejemplo n.º 3
0
def form_name_view(request):
	form = forms.FormName()

	if request.method=="POST":
		form = forms.FormName(request.POST)
		if form.is_valid():
			print("VALIDATION SUCCESS")
			print("Name : "+form.cleaned_data['name'])
			print("EMAIL : "+form.cleaned_data['email'])
			print("Text : "+form.cleaned_data['text'])


	return render(request,'AppTwo/form_page.html',{'form':form})
Ejemplo n.º 4
0
def register(request):
    form = forms.FormName()
    if request.method == 'POST':
        form = forms.FormName(request.POST)
        if form.is_valid():
            print("FIRSTNAME:" + form.cleaned_data['First_Name'])
            print("LASTNAME:" + form.cleaned_data['Last_Name'])
            print("EMAIL:" + form.cleaned_data['Email'])
            form.save(commit=True)
            return index(request)
        else:
            print("ERROR FROM INVALID")
    return render(request, 'AppTwo/register.html', {'form': form})
Ejemplo n.º 5
0
def form_name_view(request):
    form = forms.FormName

    # grab the data post by user
    if request.method == 'POST':
        form = forms.FormName(request.POST)
        #this is an instance,(request.POST) is a complex attribute package
        if form.is_valid():
            #DO SOMETHING CODE
            form.save(commit=True)#save the form into database
            return index(request)#take it back to home page
        else:
            print("ERROR FOR INVALID")
    return render(request,'AppTwo/form_page.html',{'form':form})