这里我通过表单中的post请求传递值,并且想要仅更新来自TestcaseCache表的notes字段pk是TestcaseCache表的id
def saveReviewTestcase(request,self,test_id):
if request.method == 'POST':
print test_id
input_notes=request.POST.get('textarea')
cursor = connection.cursor()
cursor.execute("UPDATE TestcaseCache SET id= test_id WHERE notes = %s", [self.input_notes])
row = cursor.fetchone()
print row
答案 0 :(得分:0)
我找出你想要更新注释的问题,其中有一些id,
<强>代替强>
cursor.execute("UPDATE TestcaseCache SET id= test_id WHERE notes = %s", [self.input_notes])
使用此
cursor.execute("UPDATE TestcaseCache SET notes= %s WHERE id = %s", [self.input_notes, test_id])