提交表单为空Djang

2024-10-03 00:27:46 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我的模板:

<form action="{% url "calculate" %}>    

    <label2>
        <select name="ASSETS_filn">
        <option selected>Files</option>

        {% for document in documents %}
        <option>{{ document.filename }}</option>
        {% endfor %}
        </select>
    </label2>
    <br>
    <label>Date</label>
    <input class="button3" type="text" name="DATE_val" />
    <input class="button3" type="submit" value="Calculate" />
</form>

label2是一个下拉菜单。我的目标是:允许用户从下拉菜单中选择一个项目,并在日期框中输入数据。这是处理此问题的视图:

^{pr2}$

但是写入.txt文件的是hehe和{}。request.POST是空的吗?在


Tags: nameform模板urlinputtypeactionselect