From 6b424dd1f641e2594339adcb2b6f01cd580be695 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 9 Mar 2020 11:15:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E9=A2=98bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- safesite/templates/questionedit3.html | 2 +- safesite/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/safesite/templates/questionedit3.html b/safesite/templates/questionedit3.html index 1cf21908..6b25122c 100644 --- a/safesite/templates/questionedit3.html +++ b/safesite/templates/questionedit3.html @@ -101,7 +101,7 @@ function tmsubmitForm(){ tmdata['type'] = 3 $.ajax({ type: "POST", - url: 'api/question?a=add', + url: 'api/question?a=edit', data: JSON.stringify(tmdata), datatype: "json", processData: false, diff --git a/safesite/views.py b/safesite/views.py index 83b8dee8..3badde7e 100644 --- a/safesite/views.py +++ b/safesite/views.py @@ -5697,7 +5697,7 @@ def apiquestion(req): type = data['type'] level = data['level'] title = data['title'] - if a == 'add': + if a == 'add' and 'id' in data and data['id']: obj = Question() else: obj = Question.objects.get(id=data['id'])