我有一个模板。这是我的模板
<form id="cal" method="get">
<span>Number1</span>
<input type="text" id="number1" name="number1"><br/>
<span>Number2</span>
<input type="text" id="number2" name="number2"><br/>
<input tye"text" id="result">
<input type="submit" value="calculated">
</form>
如何获取值number1和number2,并计算number1和number2
答案 0 :(得分:0)
在您看来:
def my_view(request):
number1 = request.POST.get('number1', None)
https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.POST