Add set scoreboard view
This commit is contained in:
parent
8e1e3b246a
commit
b3d80b5100
6 changed files with 34 additions and 1 deletions
|
@ -68,6 +68,9 @@ class Contest(models.Model):
|
|||
help_text=_('Whether the scoreboard should remain hidden for the duration '
|
||||
'of the contest.'),
|
||||
default=False)
|
||||
view_contest_scoreboard = models.ManyToManyField(Profile, verbose_name=_('view contest scoreboard'), blank=True,
|
||||
related_name='view_contest_scoreboard',
|
||||
help_text=_('These users will be able to view the scoreboard.'))
|
||||
use_clarifications = models.BooleanField(verbose_name=_('no comments'),
|
||||
help_text=_("Use clarification system instead of comments."),
|
||||
default=True)
|
||||
|
@ -142,6 +145,8 @@ class Contest(models.Model):
|
|||
return True
|
||||
if user.is_authenticated and self.organizers.filter(id=user.profile.id).exists():
|
||||
return True
|
||||
if user.is_authenticated and self.view_contest_scoreboard.filter(id=user.profile.id).exists():
|
||||
return True
|
||||
if not self.is_visible:
|
||||
return False
|
||||
if self.start_time is not None and self.start_time > timezone.now():
|
||||
|
@ -212,6 +217,8 @@ class Contest(models.Model):
|
|||
# User is in the group of private contestants
|
||||
if self.private_contestants.filter(id=user.profile.id).exists():
|
||||
return True
|
||||
if self.view_contest_scoreboard.filter(id=user.profile.id).exists():
|
||||
return True
|
||||
|
||||
# If the user can view all contests
|
||||
if user.has_perm('judge.see_private_contest'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue