mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-02-12 18:21:17 +00:00
Compare commits
No commits in common. "02c977264d58cbb4959acfd2030ea37e8060f798" and "7628387158369e72b0779806a65bef0bfef68979" have entirely different histories.
02c977264d
...
7628387158
@ -409,6 +409,12 @@ 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()
|
||||
|
@ -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:
|
||||
if request.user.registration.team.participation.valid is not None:
|
||||
raise PermissionDenied(_("The team is already validated or the validation is pending."))
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user