Skip to content

Commit 4ae1eb5

Browse files
authored
Surveys: Correct Question 404 (#11862)
* Surveys: Correct Question 404 When editing a survey question, a 404 is presented for a valid object. At some point, the content type for Questions changed to `Defect Dojo` (the verbose name of the app) rather than `dojo` (the common name) There is only one place where the name of the content type is accessed, so adding some backward compatible checks corrected the issue [sc-10195] * Update views.py
1 parent 3b32f3e commit 4ae1eb5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dojo/survey/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,17 +539,17 @@ def edit_question(request, qid):
539539
extra_tags="alert-info")
540540
type = str(ContentType.objects.get_for_model(question))
541541

542-
if type == "dojo | text question":
542+
if type in {"dojo | text question", "Defect Dojo | text question"}:
543543
form = EditTextQuestionForm(instance=question)
544-
elif type == "dojo | choice question":
544+
elif type in {"dojo | choice question", "Defect Dojo | choice question"}:
545545
form = EditChoiceQuestionForm(instance=question)
546546
else:
547547
raise Http404
548548

549549
if request.method == "POST":
550-
if type == "dojo | text question":
550+
if type in {"dojo | text question", "Defect Dojo | text question"}:
551551
form = EditTextQuestionForm(request.POST, instance=question)
552-
elif type == "dojo | choice question":
552+
elif type in {"dojo | choice question", "Defect Dojo | choice question"}:
553553
form = EditChoiceQuestionForm(request.POST, instance=question)
554554
else:
555555
raise Http404

0 commit comments

Comments
 (0)