mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 05:02:23 +00:00
Juries have more rights
This commit is contained in:
parent
72519c3d30
commit
d89f2c266d
@ -157,6 +157,9 @@ class DocumentView(LoginRequiredMixin, View):
|
||||
|
||||
if isinstance(doc, Solution):
|
||||
for pool in doc.pools.all():
|
||||
if request.user in pool.juries:
|
||||
grant = True
|
||||
break
|
||||
if pool.round == 2 and timezone.now() < doc.tournament.date_solutions_2:
|
||||
continue
|
||||
if self.request.user.team in pool.teams.all():
|
||||
|
@ -255,9 +255,7 @@ class SolutionsView(TeamMixin, BaseFormView, SingleTableView):
|
||||
return context
|
||||
|
||||
def get_queryset(self):
|
||||
qs = super().get_queryset()
|
||||
if not self.request.user.admin:
|
||||
qs = qs.filter(team=self.request.user.team)
|
||||
qs = super().get_queryset().filter(team=self.request.user.team)
|
||||
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
||||
'problem',)
|
||||
|
||||
@ -327,7 +325,7 @@ class SolutionsOrgaListView(OrgaMixin, SingleTableView):
|
||||
def get_queryset(self):
|
||||
qs = super().get_queryset()
|
||||
if not self.request.user.admin:
|
||||
qs = qs.filter(team__tournament__organizers=self.request.user)
|
||||
qs = qs.filter(Q(team__tournament__organizers=self.request.user) | Q(pools__juries=self.request.user))
|
||||
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
||||
'problem',)
|
||||
|
||||
@ -360,9 +358,7 @@ class SynthesesView(TeamMixin, BaseFormView, SingleTableView):
|
||||
return super().post(request, *args, **kwargs)
|
||||
|
||||
def get_queryset(self):
|
||||
qs = super().get_queryset()
|
||||
if not self.request.user.admin:
|
||||
qs = qs.filter(team=self.request.user.team)
|
||||
qs = super().get_queryset().filter(team=self.request.user.team)
|
||||
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
||||
'round', 'source',)
|
||||
|
||||
@ -446,7 +442,7 @@ class SynthesesOrgaListView(OrgaMixin, SingleTableView):
|
||||
def get_queryset(self):
|
||||
qs = super().get_queryset()
|
||||
if not self.request.user.admin:
|
||||
qs = qs.filter(team__tournament__organizers=self.request.user)
|
||||
qs = qs.filter(Q(team__tournament__organizers=self.request.user) | Q(team__pools__juries=self.request.user))
|
||||
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
||||
'round', 'source',)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user