1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-26 07:02:24 +00:00

Fix solution upload

This commit is contained in:
Yohann D'ANELLO 2021-05-09 10:40:45 +02:00
parent e21c3bb413
commit 9a1006b341
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -564,6 +564,7 @@ class SolutionUploadView(LoginRequiredMixin, FormView):
return self.handle_no_permission() return self.handle_no_permission()
return super().dispatch(request, *args, **kwargs) return super().dispatch(request, *args, **kwargs)
@transaction.atomic
def form_valid(self, form): def form_valid(self, form):
""" """
When a solution is submitted, it replaces a previous solution if existing, When a solution is submitted, it replaces a previous solution if existing,
@ -586,7 +587,7 @@ class SolutionUploadView(LoginRequiredMixin, FormView):
sol.save() sol.save()
sol.delete() sol.delete()
form_sol.participation = self.participation form_sol.participation = self.participation
form_sol.final = self.participation.final form_sol.final_solution = self.participation.final
form_sol.save() form_sol.save()
return super().form_valid(form) return super().form_valid(form)