From bfb21c0c4728949cbe1ab5e1583607d6ba69c70e Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 5 May 2021 22:50:07 +0100 Subject: [PATCH] . --- rapids/views.py | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/rapids/views.py b/rapids/views.py index 003c4c96..7b97dabe 100755 --- a/rapids/views.py +++ b/rapids/views.py @@ -1006,34 +1006,34 @@ class RapidViewSet(RevisionMixin, viewsets.ModelViewSet): class ExamDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView): model = Exam success_url = reverse_lazy("rapids:index") -class AddSuggestedAnswer(LoginRequiredMixin, CreateView): - model = QuestionNote - form_class = QuestionNoteForm - - #fields = ("author", "note_type", "note") - - - def get_form_kwargs(self): - kwargs = super(AddQuestionNote, self).get_form_kwargs() - # update the kwargs for the form init method with yours - kwargs.update(self.kwargs) # self.kwargs contains all url conf params - return kwargs - - def get_initial(self): - pk = self.kwargs["pk"] - question_type = self.kwargs["question_type"] - if question_type == "rapid": - question = Rapid - content_type = ContentType.objects.get(model="rapid") - elif question_type == "anatomy": - question = AnatomyQuestion - content_type = ContentType.objects.get(model="anatomyquestion") - elif question_type == "long": - question = Long - content_type = ContentType.objects.get(model="long") - else: - raise PermissionError() - - get_object_or_404(question, pk=pk) - return { "content_type" : content_type, - "object_id" : pk } \ No newline at end of file +#class AddSuggestedAnswer(LoginRequiredMixin, CreateView): +# model = QuestionNote +# form_class = QuestionNoteForm +# +# #fields = ("author", "note_type", "note") +# +# +# def get_form_kwargs(self): +# kwargs = super(AddQuestionNote, self).get_form_kwargs() +# # update the kwargs for the form init method with yours +# kwargs.update(self.kwargs) # self.kwargs contains all url conf params +# return kwargs +# +# def get_initial(self): +# pk = self.kwargs["pk"] +# question_type = self.kwargs["question_type"] +# if question_type == "rapid": +# question = Rapid +# content_type = ContentType.objects.get(model="rapid") +# elif question_type == "anatomy": +# question = AnatomyQuestion +# content_type = ContentType.objects.get(model="anatomyquestion") +# elif question_type == "long": +# question = Long +# content_type = ContentType.objects.get(model="long") +# else: +# raise PermissionError() +# +# get_object_or_404(question, pk=pk) +# return { "content_type" : content_type, +# "object_id" : pk } \ No newline at end of file