def add(request): form = Output() if request.method == 'POST': form = Output(request.POST) if form.is_valid(): clean_form = form.cleaned_data input1 = clean_form['input1'] input2 = clean_form['input2'] out = input1 + input2 return render_to_response('add.html',{'calculator':form,'answer':out},context_instance=RequestContext(request)) else: return HttpResponseRedirect("/admin") else: return render_to_response('add.html',{'calculator':form},context_instance=RequestContext(request))
def app_add(request): form = Output() if request.method == 'POST': form = Output(request.POST) if form.is_valid(): clean_form = form.cleaned_data value1 = clean_form['input1'] value2 = clean_form['input2'] out = value1 + value2 return render_to_response('add.html', {'calculator':form, 'answer':out}, context_instance = RequestContext(request)) else: return render_to_response('add.html', {'calculator':form}, context_instance = RequestContext(request)) else: return render_to_response('add.html', {'calculator':form}, context_instance = RequestContext(request))