From a121e2d5de0d1271d9b23faea80dba18ee9f7d81 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 26 Apr 2021 11:19:01 +0100 Subject: [PATCH] . --- rapids/forms.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rapids/forms.py b/rapids/forms.py index cd7b02cd..5ce41e42 100755 --- a/rapids/forms.py +++ b/rapids/forms.py @@ -83,7 +83,7 @@ class RapidForm(ModelForm): # Adding this javascript is crucial js = ["jsi18n.js", "tesseract.min.js"] - def __init__(self, user, *args, **kwargs): + def __init__(self, *args, **kwargs): self.user = kwargs.pop('user') # To get request.user. Do not use kwargs.pop('user', None) due to potential security hole if kwargs.get("instance"): # We get the 'initial' keyword argument or initialize it @@ -120,9 +120,10 @@ class RapidForm(ModelForm): ) if self.user.groups.filter(name="rapid_checker").exists(): - return Exam.objects.all() + exam_queryset = Exam.objects.all() + else: + exam_queryset = Exam.objects.filter(author__id=self.user.id) - exam_queryset = Exam.objects.filter(author__id=self.user.id) self.fields["exams"] = ModelMultipleChoiceField( required=False,