.
This commit is contained in:
+12
-1
@@ -915,9 +915,20 @@ class QuestionDelete(AuthorOrCheckerRequiredMixin, DeleteView):
|
|||||||
RapidExamViews = ExamViews(Exam, Rapid, "rapids", "rapid", loadJsonAnswer)
|
RapidExamViews = ExamViews(Exam, Rapid, "rapids", "rapid", loadJsonAnswer)
|
||||||
|
|
||||||
class ExamViewSet(viewsets.ModelViewSet):
|
class ExamViewSet(viewsets.ModelViewSet):
|
||||||
queryset = Exam.objects.all().order_by('name')
|
#queryset = Exam.objects.all().order_by('name')
|
||||||
serializer_class = ExamSerializer
|
serializer_class = ExamSerializer
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
"""
|
||||||
|
This view should return a list of all the purchases
|
||||||
|
for the currently authenticated user.
|
||||||
|
"""
|
||||||
|
user = self.request.user
|
||||||
|
if user.groups.filter(name="rapid_checker").exists():
|
||||||
|
return Exam.objects.all()
|
||||||
|
|
||||||
|
return Purchase.objects.filter(author__id=user.id)
|
||||||
|
|
||||||
class ExamCreate(LoginRequiredMixin, CreateView):
|
class ExamCreate(LoginRequiredMixin, CreateView):
|
||||||
model = Exam
|
model = Exam
|
||||||
form_class = ExamForm
|
form_class = ExamForm
|
||||||
|
|||||||
Reference in New Issue
Block a user