.
This commit is contained in:
+2
-2
@@ -214,10 +214,10 @@ def answer_suggestion_submit(request):
|
||||
else:
|
||||
return JsonResponse({"success": False, "error": "Invalid question type"})
|
||||
|
||||
if AnswerModel.objects.filter(answer=answer_string):
|
||||
q = get_object_or_404(question, pk=qid)
|
||||
if AnswerModel.objects.filter(answer=answer_string, question=q):
|
||||
return JsonResponse({"success": False, "error": "Answer already exists"})
|
||||
|
||||
q = get_object_or_404(question, pk=qid)
|
||||
|
||||
a = AnswerModel(question=q, answer=answer_string, status=status, proposed=True)
|
||||
a.save()
|
||||
|
||||
Reference in New Issue
Block a user