mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-23 16:36:37 +02:00
Add button to update notes
Add jury president field for pools Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -885,6 +885,29 @@ class PoolRemoveJuryView(VolunteerMixin, DetailView):
|
||||
return redirect(reverse_lazy('participation:pool_jury', args=(pool.pk,)))
|
||||
|
||||
|
||||
class PoolPresideJuryView(VolunteerMixin, DetailView):
|
||||
model = Pool
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
if not request.user.is_authenticated:
|
||||
return self.handle_no_permission()
|
||||
if request.user.registration.is_admin or request.user.registration.is_volunteer \
|
||||
and self.get_object().tournament in request.user.registration.organized_tournaments.all():
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
return self.handle_no_permission()
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
pool = self.get_object()
|
||||
if not pool.juries.filter(pk=kwargs['jury_id']).exists():
|
||||
raise Http404
|
||||
jury = pool.juries.get(pk=kwargs['jury_id'])
|
||||
pool.jury_president = jury
|
||||
pool.save()
|
||||
messages.success(request, _("The jury {name} has been successfully promoted president!")
|
||||
.format(name=f"{jury.user.first_name} {jury.user.last_name}"))
|
||||
return redirect(reverse_lazy('participation:pool_jury', args=(pool.pk,)))
|
||||
|
||||
|
||||
class PoolUploadNotesView(VolunteerMixin, FormView, DetailView):
|
||||
model = Pool
|
||||
form_class = UploadNotesForm
|
||||
|
Reference in New Issue
Block a user