【发布时间】:2020-06-21 13:42:40
【问题描述】:
我是 django 模板的新手。我在标题中有一个搜索字段,我想以这种格式发送搜索到的关键字
search/q/{{keyword}}/
我的html代码是这样的
<form action="{% url 'content.search' q=searched_key %}" class="search-input">
<input type="text" name="searched_key">
<button type="submit"><i data-feather="search"></i></button>
</form>
我想获取输入值并发送,但结果 url 是这个
http://127.0.0.1:8000/contents/search/q//?searched_key=test
我怎样才能以正确的方式做到这一点?
【问题讨论】:
标签: html django forms django-templates