From f0bca6982568a7c623180158da98d45795765792 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 25 Jul 2020 18:18:53 +0200 Subject: [PATCH] :bug: Minor fixes --- apps/member/views.py | 2 +- apps/registration/views.py | 2 +- apps/wei/forms/registration.py | 2 +- apps/wei/models.py | 1 + apps/wei/tables.py | 2 +- apps/wei/views.py | 2 +- templates/wei/weilist_sample.tex | 1 + 7 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/member/views.py b/apps/member/views.py index 37f04304..40e0fb0c 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -303,7 +303,7 @@ class ClubListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView): """ Filter the user list with the given pattern. """ - qs = super().get_queryset().filter() + qs = super().get_queryset().distinct() if "search" in self.request.GET: pattern = self.request.GET["search"] diff --git a/apps/registration/views.py b/apps/registration/views.py index 2c91a604..a0e62202 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -164,7 +164,7 @@ class FutureUserListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableVi :param kwargs: :return: """ - qs = super().get_queryset().filter(profile__registration_valid=False) + qs = super().get_queryset().distinct().filter(profile__registration_valid=False) if "search" in self.request.GET: pattern = self.request.GET["search"] diff --git a/apps/wei/forms/registration.py b/apps/wei/forms/registration.py index 96555372..9ce3a350 100644 --- a/apps/wei/forms/registration.py +++ b/apps/wei/forms/registration.py @@ -96,7 +96,7 @@ class WEIMembershipForm(forms.ModelForm): class BusForm(forms.ModelForm): class Meta: model = Bus - fields = '__all__' + exclude = ('information_json',) widgets = { "wei": Autocomplete( WEIClub, diff --git a/apps/wei/models.py b/apps/wei/models.py index 9cee0d61..6153a870 100644 --- a/apps/wei/models.py +++ b/apps/wei/models.py @@ -113,6 +113,7 @@ class BusTeam(models.Model): name = models.CharField( max_length=255, + verbose_name=_("name"), ) color = models.PositiveIntegerField( # Use a color picker to get the hexa code diff --git a/apps/wei/tables.py b/apps/wei/tables.py index 36d09342..e4d09fec 100644 --- a/apps/wei/tables.py +++ b/apps/wei/tables.py @@ -144,7 +144,7 @@ class BusTable(tables.Table): ) def render_teams(self, value): - return ", ".join(team.name for team in value.all()) + return ", ".join(team.name for team in value.order_by('name').all()) def render_count(self, value): return str(value) + " " + (str(_("members")) if value > 0 else str(_("member"))) diff --git a/apps/wei/views.py b/apps/wei/views.py index 597a44d4..76a01fae 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -330,7 +330,7 @@ class BusManageView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): bus = self.object teams = BusTeam.objects.filter(PermissionBackend.filter_queryset(self.request.user, BusTeam, "view")) \ - .filter(bus=bus).annotate(count=Count("memberships")) + .filter(bus=bus).annotate(count=Count("memberships")).order_by("name") teams_table = BusTeamTable(data=teams, prefix="team-") context["teams"] = teams_table diff --git a/templates/wei/weilist_sample.tex b/templates/wei/weilist_sample.tex index a2ff0755..19eb0cdc 100644 --- a/templates/wei/weilist_sample.tex +++ b/templates/wei/weilist_sample.tex @@ -5,6 +5,7 @@ \usepackage[french]{babel} \usepackage[margin=1.5cm]{geometry} +\usepackage{lmodern} \usepackage{ltablex} \usepackage{tabularx}