【发布时间】:2018-12-01 16:41:27
【问题描述】:
任务:在 django-table 顶部添加简单搜索以过滤其值。
问题:f^tup 某处并在将值放入搜索窗口后传递请求时收到此错误:
Method Not Allowed (POST): /warscrolls/
[22/Jun/2018 10:27:17] "POST /warscrolls/ HTTP/1.1" 405 0
我的网址是这样的:
url(r'^warscrolls/$', ScrollListView.as_view(filter_class=ScrollListFilter,
template_name='scroll_list.html'), name='warscrolls'),
我在 html 模板中的搜索表单如下所示:
<form method="post" class="form-inline form-search pull-right">
{% csrf_token %}
<div>
<input id="search_form_id" name="search" type="text" class="form-control col-md-3" placeholder="ID, Name, Account #, ZIP"{% if search %} value="{{ search }}"{% endif %}>
<button type="submit" class="btn btn-small btn-dark"><i class="fa fa-search"></i> Search</button>
</div>
</form>
我错过了什么?
【问题讨论】:
标签: django django-views django-filter django-tables2