我已经从数据库中检索到数据并将其显示在表中。 现在单击编辑按钮,我想编辑表。下面是我的代码。但什么也没发生。我无法编辑内容。没有得到任何错误。 我是个新手。Plzz帮助。。在
我的视图.py文件
def editquestiondata(request, id):
info = Trans.objects.get(pk = id)
info.transtype_id = request.POST.get('editexplain')
info.save()
return HttpResponse('updated')
我的网址.py文件
^{pr2}$HTML模板
<table border="1" style="width:800px">
<button type="button" value="Edit explain" name="editexplain">Edit</button>
<button type="button" onclick="alert('Changes Saved!')">Save</button>
<tr>
{% for s in questdata %}
</tr>
<tr>
<td> {{ s.script }} </td>
<td> {{ s.id }} </td>
</tr>
{% endfor %}
</table>
找到答案了。。。在
我的HTML模板
我的视图.py文件
^{pr2}$相关问题 更多 >
编程相关推荐