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'])