Compare commits

...

2 Commits

Author SHA1 Message Date
Yohann D'ANELLO 02c977264d
Pending teams can change their composition 2020-12-26 19:43:46 +01:00
Yohann D'ANELLO 8f86ea15c8
Pending teams can change their composition 2020-12-26 19:24:37 +01:00
2 changed files with 1 additions and 7 deletions

View File

@ -409,12 +409,6 @@ class TestStudentParticipation(TestCase):
self.user.registration.team = self.team
self.user.registration.save()
# Team is pending validation
self.team.participation.valid = False
self.team.participation.save()
response = self.client.post(reverse("participation:team_leave"))
self.assertEqual(response.status_code, 403)
# Team is valid
self.team.participation.valid = True
self.team.participation.save()

View File

@ -341,7 +341,7 @@ class TeamLeaveView(LoginRequiredMixin, TemplateView):
return self.handle_no_permission()
if not request.user.registration.participates or not request.user.registration.team:
raise PermissionDenied(_("You are not in a team."))
if request.user.registration.team.participation.valid is not None:
if request.user.registration.team.participation.valid:
raise PermissionDenied(_("The team is already validated or the validation is pending."))
return super().dispatch(request, *args, **kwargs)