From 5b61db882168eeea998a80c9c88a8444d63285ea Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 5 Apr 2020 16:18:56 +0200 Subject: [PATCH] We adhere other users, not ourself... --- apps/member/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/member/views.py b/apps/member/views.py index ed5826ef..5391413b 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -361,7 +361,7 @@ class ClubAddMemberView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView): def form_valid(self, form): club = Club.objects.filter(PermissionBackend.filter_queryset(self.request.user, Club, "view"))\ .get(pk=self.kwargs["pk"]) - user = self.request.user + user = form.instance.user form.instance.club = club if user.profile.paid: @@ -379,6 +379,7 @@ class ClubAddMemberView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView): # TODO Send a notification to the user (with a mail?) to tell her/him to credit her/his note form.add_error('user', _("This user don't have enough money to join this club, and can't have a negative balance.")) + return super().form_invalid(form) if club.parent_club is not None: if not Membership.objects.filter(user=form.instance.user, club=club.parent_club).exists():