1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-08-21 09:28:41 +02:00

Test leave team

This commit is contained in:
Yohann D'ANELLO
2020-11-03 14:43:51 +01:00
parent bf32c34d4c
commit 0a3fffe21e
2 changed files with 47 additions and 1 deletions

View File

@@ -316,7 +316,7 @@ class TeamLeaveView(LoginRequiredMixin, TemplateView):
def dispatch(self, request, *args, **kwargs):
if not request.user.is_authenticated:
return self.handle_no_permission()
if not request.user.registration.team:
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:
raise PermissionDenied(_("The team is already validated or the validation is pending."))