def test2 request if request method POST form Test request POST if for

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
def test2(request):
if request.method == 'POST':
form = Test(request.POST)
if form.is_valid():
return HttpResponseRedirect('/profile/')
else:
form = Test()
return render_to_response('test.html',{'form':form})
else:
form = Test()
return render_to_response('test.html',{'form':form})