.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user