文章目錄
csrf_token 是爲了阻止跨站請求
django 中, 使用 form 表單提交 post 請求時, 將{% csrf_token %}寫在 form 表單中即可
<form action="" method="post">
{% csrf_token %}
<input type="text" name="title">
<select name="author_id">
{% for foo in data %}
<option value="{{ foo.id }}">{{ foo.name }}</option>
{% endfor %}
</select>
<input type="submit" value="提交">
</form>