Merge branch 'beta' into 'main'

revert sort tables to member views

See merge request bde/nk20!262
This commit is contained in:
korenstin 2024-08-25 15:17:36 +02:00
commit 2ab5c4082a
1 changed files with 3 additions and 6 deletions

View File

@ -166,8 +166,7 @@ class UserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
# Display only the most recent membership # Display only the most recent membership
club_list = club_list.distinct("club__name")\ club_list = club_list.distinct("club__name")\
if settings.DATABASES["default"]["ENGINE"] == 'django.db.backends.postgresql' else club_list if settings.DATABASES["default"]["ENGINE"] == 'django.db.backends.postgresql' else club_list
club_list_order_by = self.request.GET.getlist("membership-sort", ("club__name", "-date_start")) membership_table = MembershipTable(data=club_list, prefix='membership-')
membership_table = MembershipTable(data=club_list, prefix='membership-', order_by=club_list_order_by)
membership_table.paginate(per_page=10, page=self.request.GET.get("membership-page", 1)) membership_table.paginate(per_page=10, page=self.request.GET.get("membership-page", 1))
context['club_list'] = membership_table context['club_list'] = membership_table
@ -477,8 +476,7 @@ class ClubDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
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())\ date_start__lte=date.today(), date_end__gte=date.today())\
.order_by('user__last_name').all() .order_by('user__last_name').all()
managers_order_by = self.request.GET.getlist("managers-sort", ('user__last_name')) context["managers"] = ClubManagerTable(data=managers, prefix="managers-")
context["managers"] = ClubManagerTable(data=managers, prefix="managers-", order_by=managers_order_by)
# transaction history # transaction history
club_transactions = Transaction.objects.all().filter(Q(source=club.note) | Q(destination=club.note))\ club_transactions = Transaction.objects.all().filter(Q(source=club.note) | Q(destination=club.note))\
.filter(PermissionBackend.filter_queryset(self.request, Transaction, "view"))\ .filter(PermissionBackend.filter_queryset(self.request, Transaction, "view"))\
@ -496,8 +494,7 @@ class ClubDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
club_member = club_member.distinct("user__username")\ club_member = club_member.distinct("user__username")\
if settings.DATABASES["default"]["ENGINE"] == 'django.db.backends.postgresql' else club_member if settings.DATABASES["default"]["ENGINE"] == 'django.db.backends.postgresql' else club_member
membership_order_by = self.request.GET.getlist("membership-sort", ("user__username", "-date_start")) membership_table = MembershipTable(data=club_member, prefix="membership-")
membership_table = MembershipTable(data=club_member, prefix="membership-", order_by=membership_order_by)
membership_table.paginate(per_page=5, page=self.request.GET.get('membership-page', 1)) membership_table.paginate(per_page=5, page=self.request.GET.get('membership-page', 1))
context['member_list'] = membership_table context['member_list'] = membership_table