add a redirct view mixin
This commit is contained in:
+2
-10
@@ -50,6 +50,7 @@ from generic.views import (
|
||||
ExamUpdateBase,
|
||||
ExamViews,
|
||||
GenericViewBase,
|
||||
UpdateQuestionMixin,
|
||||
exam_inactive,
|
||||
)
|
||||
|
||||
@@ -317,19 +318,10 @@ class QuestionCreate(QuestionCreateBase):
|
||||
return initial
|
||||
|
||||
|
||||
class QuestionUpdate(RevisionMixin, AuthorOrCheckerRequiredMixin, UpdateView):
|
||||
class QuestionUpdate(AuthorOrCheckerRequiredMixin, UpdateQuestionMixin):
|
||||
model = Question
|
||||
form_class = QuestionForm
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super(QuestionUpdate, self).get_form_kwargs()
|
||||
kwargs.update({"user": self.request.user})
|
||||
return kwargs
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(QuestionUpdate, self).get_context_data(**kwargs)
|
||||
return context
|
||||
|
||||
def form_valid(self, form):
|
||||
self.object = form.save(commit=False)
|
||||
self.object.save()
|
||||
|
||||
Reference in New Issue
Block a user