![](/img/trans.png)
[英]Collect data from a class based form UpdateView django for use in views.py
[英]Fetch Data from html form to use it in views.py-Django
您的表單具有GET
方法,但鑒於您正在嘗試從POST
獲取數據。 將查看代碼更改為此:
data=request.GET.get('Location')
你也應該動
return HttpResponse('hello')
在視圖的末尾。 return
后的代碼將永遠不會被調用。
如果您在表格中使用GET
在視圖中
location = request.GET.get('Location')
print(location)
return HttpResponse('whatever')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.