mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-07-01 01:21:18 +02:00
Update juries lines in Google Sheet after a pool update (not on every save)
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -880,6 +880,13 @@ class PoolUpdateView(VolunteerMixin, UpdateView):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
return self.handle_no_permission()
|
||||
|
||||
def form_valid(self, form):
|
||||
ret = super().form_valid(form)
|
||||
# Update Google Sheets juries lines
|
||||
if os.getenv('GOOGLE_PRIVATE_KEY_ID', None):
|
||||
self.object.update_juries_lines_spreadsheet()
|
||||
return ret
|
||||
|
||||
|
||||
class PoolUpdateTeamsView(VolunteerMixin, UpdateView):
|
||||
model = Pool
|
||||
@ -1075,6 +1082,10 @@ class PoolJuryView(VolunteerMixin, FormView, DetailView):
|
||||
self.object.juries.add(reg)
|
||||
self.object.save()
|
||||
|
||||
# Update Google Sheets juries lines
|
||||
if os.getenv('GOOGLE_PRIVATE_KEY_ID', None):
|
||||
self.object.update_juries_lines_spreadsheet()
|
||||
|
||||
# Add notification
|
||||
messages.success(self.request, _("The jury {name} has been successfully added!")
|
||||
.format(name=f"{user.first_name} {user.last_name}"))
|
||||
|
Reference in New Issue
Block a user