This commit is contained in:
Ross
2022-05-03 18:49:30 +01:00
parent 4e58899e54
commit 7310e31ffc
9 changed files with 145 additions and 0 deletions
+15
View File
@@ -66,6 +66,16 @@ class Condition(tagulous.models.TagModel):
class Sign(tagulous.models.TagModel):
pass
class QuestionBase(models.Model):
authors_only = models.BooleanField(
help_text="If true only question authors will be able to view.",
default=False,
)
class Meta:
abstract = True
class ExamBase(models.Model):
name = models.CharField(max_length=200, help_text="Name of the exam")
@@ -108,6 +118,11 @@ class ExamBase(models.Model):
default=False,
)
authors_only = models.BooleanField(
help_text="If true only exam authors will be able to view.",
default=False,
)
stats_mean = models.FloatField(default=0)
stats_mode = models.CharField(default=0, max_length=25)
stats_median = models.FloatField(default=0)
+6
View File
@@ -299,6 +299,9 @@ class ExamViews(View, LoginRequiredMixin):
if (exam.open_access and exam.active) or user in exam.get_author_objects():
return True
if exam.authors_only:
return False
if (
self.app_name == "rapids"
and not user.groups.filter(name="rapid_checker").exists()
@@ -350,6 +353,9 @@ class ExamViews(View, LoginRequiredMixin):
if exam.open_access or user in exam.get_author_objects():
return True
if exam.authors_only:
return False
if (
self.app_name == "rapids"
and not user.groups.filter(name="rapid_checker").exists()