【发布时间】:2022-12-12 03:10:34
【问题描述】:
这是我的表格
<h1>ADD LIST</h1>
<form action="addList/" method="post">
{% csrf_token %}
<div class = "container">
<label>List Name</label><br>
<input name="listname" class= "listNamec"><br><br></input>
<label>List title</label><br>
<input name="listtitle" class= "listTitlec"><br><br></input>
</div>
</form>
这是我的功能
def addList(response):
listname = response.POST['listname']
list.name = listname
list.save()
return render(response, 'main/index.html', {})
错误 :
raise MultiValueDictKeyError(key)
django.utils.datastructures.MultiValueDictKeyError: 'listname'
我需要将这些添加到待办事项列表数据库,但无法正常工作:(
【问题讨论】:
标签: python django django-models django-views