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
1 changed files with 2 additions and 1 deletions

View File

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