1 回答
TA贡献1735条经验 获得超5个赞
默认情况下, [ ListView
Django-doc]不会实现 POST 请求的处理程序。搜索通常通过 GET 请求完成,因此您应该使用:
<form class="box" action="{% url 'result' %}" method="GET">
<h1>Product Check</h1>
<p> Please enter the serial id of your product to check it.</p>
<input type="text" name="q" placeholder="Serial Number">
<input type="submit" placeholder="Check">
</form>
此外<input type="submit">不应该有name="q"属性。
您还可以将文本框的类型更改为type="search"
[mozilla] :
<form class="box" action="{% url 'result' %}" method="GET">
<h1>Product Check</h1>
<p> Please enter the serial id of your product to check it.</p>
<input type="search" name="q" placeholder="Serial Number">
<input type="submit" placeholder="Check">
</form>
添加回答
举报