From fd83fe19bf09dc847e911fa880b01c5e57c9efd1 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Thu, 1 Oct 2020 09:17:02 +0200 Subject: [PATCH] Fix some membership date control --- apps/member/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/member/views.py b/apps/member/views.py index 6c4673fe..5cce34f5 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -395,7 +395,8 @@ class ClubDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): if PermissionBackend.check_perm(self.request.user, "member.change_club_membership_start", club): club.update_membership_dates() # managers list - managers = Membership.objects.filter(club=self.object, roles__name="Bureau de club")\ + managers = Membership.objects.filter(club=self.object, roles__name="Bureau de club", + date_start__lte=date.today(), date_end__gte=date.today())\ .order_by('user__last_name').all() context["managers"] = ClubManagerTable(data=managers, prefix="managers-") # transaction history @@ -641,8 +642,8 @@ class ClubAddMemberView(ProtectQuerysetMixin, ProtectedCreateView): if club.name != "Kfet" and club.parent_club and not Membership.objects.filter( user=form.instance.user, club=club.parent_club, - date_start__lte=club.parent_club.membership_start, - date_end__gte=club.parent_club.membership_end, + date_start__gte=club.parent_club.membership_start, + date_end__lte=club.parent_club.membership_end, ).exists(): form.add_error('user', _('User is not a member of the parent club') + ' ' + club.parent_club.name) error = True