Better tables

This commit is contained in:
Yohann D'ANELLO 2020-04-21 17:49:06 +02:00
parent 73878d03ab
commit f83f6da79a
12 changed files with 372 additions and 49 deletions

View File

@ -3,7 +3,7 @@
from rest_framework import serializers from rest_framework import serializers
from ..models import WEIClub, Bus, BusTeam from ..models import WEIClub, Bus, BusTeam, WEIRole, WEIRegistration, WEIMembership
class WEIClubSerializer(serializers.ModelSerializer): class WEIClubSerializer(serializers.ModelSerializer):
@ -37,3 +37,36 @@ class BusTeamSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = BusTeam model = BusTeam
fields = '__all__' fields = '__all__'
class WEIRoleSerializer(serializers.ModelSerializer):
"""
REST API Serializer for WEI roles.
The djangorestframework plugin will analyse the model `WEIRole` and parse all fields in the API.
"""
class Meta:
model = WEIRole
fields = '__all__'
class WEIRegistrationSerializer(serializers.ModelSerializer):
"""
REST API Serializer for WEI registrations.
The djangorestframework plugin will analyse the model `WEIRegistration` and parse all fields in the API.
"""
class Meta:
model = WEIRegistration
fields = '__all__'
class WEIMembershipSerializer(serializers.ModelSerializer):
"""
REST API Serializer for WEI memberships.
The djangorestframework plugin will analyse the model `WEIMembership` and parse all fields in the API.
"""
class Meta:
model = WEIMembership
fields = '__all__'

View File

@ -1,7 +1,8 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay # Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from .views import WEIClubViewSet, BusViewSet, BusTeamViewSet from .views import WEIClubViewSet, BusViewSet, BusTeamViewSet, WEIRoleViewSet, WEIRegistrationViewSet, \
WEIMembershipViewSet
def register_wei_urls(router, path): def register_wei_urls(router, path):
@ -11,3 +12,6 @@ def register_wei_urls(router, path):
router.register(path + '/club', WEIClubViewSet) router.register(path + '/club', WEIClubViewSet)
router.register(path + '/bus', BusViewSet) router.register(path + '/bus', BusViewSet)
router.register(path + '/team', BusTeamViewSet) router.register(path + '/team', BusTeamViewSet)
router.register(path + '/role', WEIRoleViewSet)
router.register(path + '/registration', WEIRegistrationViewSet)
router.register(path + '/membership', WEIMembershipViewSet)

View File

@ -4,8 +4,9 @@ from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.filters import SearchFilter from rest_framework.filters import SearchFilter
from api.viewsets import ReadProtectedModelViewSet from api.viewsets import ReadProtectedModelViewSet
from .serializers import WEIClubSerializer, BusSerializer, BusTeamSerializer from .serializers import WEIClubSerializer, BusSerializer, BusTeamSerializer, WEIRoleSerializer, \
from ..models import WEIClub, Bus, BusTeam WEIRegistrationSerializer, WEIMembershipSerializer
from ..models import WEIClub, Bus, BusTeam, WEIRole, WEIRegistration, WEIMembership
class WEIClubViewSet(ReadProtectedModelViewSet): class WEIClubViewSet(ReadProtectedModelViewSet):
@ -27,7 +28,7 @@ class BusViewSet(ReadProtectedModelViewSet):
The djangorestframework plugin will get all `Bus` objects, serialize it to JSON with the given serializer, The djangorestframework plugin will get all `Bus` objects, serialize it to JSON with the given serializer,
then render it on /api/wei/bus/ then render it on /api/wei/bus/
""" """
queryset = Bus.objects.all() queryset = Bus.objects
serializer_class = BusSerializer serializer_class = BusSerializer
filter_backends = [SearchFilter, DjangoFilterBackend] filter_backends = [SearchFilter, DjangoFilterBackend]
search_fields = ['$name', ] search_fields = ['$name', ]
@ -40,8 +41,46 @@ class BusTeamViewSet(ReadProtectedModelViewSet):
The djangorestframework plugin will get all `BusTeam` objects, serialize it to JSON with the given serializer, The djangorestframework plugin will get all `BusTeam` objects, serialize it to JSON with the given serializer,
then render it on /api/wei/team/ then render it on /api/wei/team/
""" """
queryset = BusTeam.objects.all() queryset = BusTeam.objects
serializer_class = BusTeamSerializer serializer_class = BusTeamSerializer
filter_backends = [SearchFilter, DjangoFilterBackend] filter_backends = [SearchFilter, DjangoFilterBackend]
search_fields = ['$name', ] search_fields = ['$name', ]
filterset_fields = ['name', 'bus', 'bus__wei', ] filterset_fields = ['name', 'bus', 'bus__wei', ]
class WEIRoleViewSet(ReadProtectedModelViewSet):
"""
REST API View set.
The djangorestframework plugin will get all `WEIRole` objects, serialize it to JSON with the given serializer,
then render it on /api/wei/role/
"""
queryset = WEIRole.objects
serializer_class = WEIRoleSerializer
filter_backends = [SearchFilter]
search_fields = ['$name', ]
class WEIRegistrationViewSet(ReadProtectedModelViewSet):
"""
REST API View set.
The djangorestframework plugin will get all WEIRegistration objects, serialize it to JSON with the given serializer,
then render it on /api/wei/registration/
"""
queryset = WEIRegistration.objects
serializer_class = WEIRegistrationSerializer
filter_backends = [SearchFilter, DjangoFilterBackend]
search_fields = ['$user__username', ]
filterset_fields = ['user', 'wei', ]
class WEIMembershipViewSet(ReadProtectedModelViewSet):
"""
REST API View set.
The djangorestframework plugin will get all `BusTeam` objects, serialize it to JSON with the given serializer,
then render it on /api/wei/membership/
"""
queryset = WEIMembership.objects
serializer_class = WEIMembershipSerializer
filter_backends = [SearchFilter, DjangoFilterBackend]
search_fields = ['$user__username', '$bus__name', '$team__name', ]
filterset_fields = ['user', 'club', 'bus', 'team', ]

View File

@ -77,7 +77,7 @@ class WEIRegistrationTable(tables.Table):
} }
model = WEIRegistration model = WEIRegistration
template_name = 'django_tables2/bootstrap4.html' template_name = 'django_tables2/bootstrap4.html'
fields = ('user', 'first_year',) fields = ('user', 'user.first_name', 'user.last_name', 'first_year',)
row_attrs = { row_attrs = {
'class': 'table-row', 'class': 'table-row',
'id': lambda record: "row-" + str(record.pk), 'id': lambda record: "row-" + str(record.pk),
@ -86,13 +86,28 @@ class WEIRegistrationTable(tables.Table):
class WEIMembershipTable(tables.Table): class WEIMembershipTable(tables.Table):
user = tables.LinkColumn(
'wei:wei_update_registration',
args=[A('registration.pk')],
)
bus = tables.LinkColumn(
'wei:manage_bus',
args=[A('bus.pk')],
)
team = tables.LinkColumn(
'wei:manage_bus_team',
args=[A('bus.pk')],
)
class Meta: class Meta:
attrs = { attrs = {
'class': 'table table-condensed table-striped table-hover' 'class': 'table table-condensed table-striped table-hover'
} }
model = WEIMembership model = WEIMembership
template_name = 'django_tables2/bootstrap4.html' template_name = 'django_tables2/bootstrap4.html'
fields = ('user', ) fields = ('user', 'user.first_name', 'user.last_name', 'bus', 'team', )
row_attrs = { row_attrs = {
'class': 'table-row', 'class': 'table-row',
'id': lambda record: "row-" + str(record.pk), 'id': lambda record: "row-" + str(record.pk),

View File

@ -4,6 +4,7 @@
from django.urls import path from django.urls import path
from .views import CurrentWEIDetailView, WEIListView, WEICreateView, WEIDetailView, WEIUpdateView,\ from .views import CurrentWEIDetailView, WEIListView, WEICreateView, WEIDetailView, WEIUpdateView,\
WEIRegistrationsView, WEIMembershipsView,\
BusCreateView, BusManageView, BusUpdateView, BusTeamCreateView, BusTeamManageView, BusTeamUpdateView,\ BusCreateView, BusManageView, BusUpdateView, BusTeamCreateView, BusTeamManageView, BusTeamUpdateView,\
WEIRegister1AView, WEIRegister2AView, WEIUpdateRegistrationView, WEIDeleteRegistrationView,\ WEIRegister1AView, WEIRegister2AView, WEIUpdateRegistrationView, WEIDeleteRegistrationView,\
WEIValidateRegistrationView, WEISurveyView, WEISurveyEndView, WEIClosedView WEIValidateRegistrationView, WEISurveyView, WEISurveyEndView, WEIClosedView
@ -16,6 +17,8 @@ urlpatterns = [
path('create/', WEICreateView.as_view(), name="wei_create"), path('create/', WEICreateView.as_view(), name="wei_create"),
path('detail/<int:pk>/', WEIDetailView.as_view(), name="wei_detail"), path('detail/<int:pk>/', WEIDetailView.as_view(), name="wei_detail"),
path('update/<int:pk>/', WEIUpdateView.as_view(), name="wei_update"), path('update/<int:pk>/', WEIUpdateView.as_view(), name="wei_update"),
path('detail/<int:pk>/registrations/', WEIRegistrationsView.as_view(), name="wei_registrations"),
path('detail/<int:pk>/memberships/', WEIMembershipsView.as_view(), name="wei_memberships"),
path('add-bus/<int:pk>/', BusCreateView.as_view(), name="add_bus"), path('add-bus/<int:pk>/', BusCreateView.as_view(), name="add_bus"),
path('manage-bus/<int:pk>/', BusManageView.as_view(), name="manage_bus"), path('manage-bus/<int:pk>/', BusManageView.as_view(), name="manage_bus"),
path('update-bus/<int:pk>/', BusUpdateView.as_view(), name="update_bus"), path('update-bus/<int:pk>/', BusUpdateView.as_view(), name="update_bus"),

View File

@ -5,6 +5,7 @@ from datetime import datetime, date
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.db.models import Q from django.db.models import Q
from django.forms import HiddenInput from django.forms import HiddenInput
from django.shortcuts import redirect from django.shortcuts import redirect
@ -14,7 +15,7 @@ from django.utils.translation import gettext_lazy as _
from django.views.generic.edit import BaseFormView, DeleteView from django.views.generic.edit import BaseFormView, DeleteView
from django_tables2 import SingleTableView from django_tables2 import SingleTableView
from member.models import Membership, Club from member.models import Membership, Club
from note.models import Transaction, NoteClub from note.models import Transaction, NoteClub, Alias
from note.tables import HistoryTable from note.tables import HistoryTable
from permission.backends import PermissionBackend from permission.backends import PermissionBackend
from permission.views import ProtectQuerysetMixin from permission.views import ProtectQuerysetMixin
@ -128,6 +129,78 @@ class WEIDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
return context return context
class WEIMembershipsView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
"""
List all WEI memberships
"""
model = WEIMembership
table_class = WEIMembershipTable
def dispatch(self, request, *args, **kwargs):
self.club = WEIClub.objects.get(pk=self.kwargs["pk"])
return super().dispatch(request, *args, **kwargs)
def get_queryset(self, **kwargs):
qs = super().get_queryset(**kwargs).filter(club=self.club)
pattern = self.request.GET.get("search", "")
if not pattern:
return qs.none()
qs = qs.filter(
Q(user__first_name__iregex=pattern)
| Q(user__last_name__iregex=pattern)
| Q(user__note__alias__name__iregex="^" + pattern)
| Q(user__note__alias__normalized_name__iregex="^" + Alias.normalize(pattern))
| Q(bus__name__iregex=pattern)
| Q(team__name__iregex=pattern)
)
return qs[:20]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["club"] = self.club
context["title"] = _("Find WEI Membership")
return context
class WEIRegistrationsView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
"""
List all non-validated WEI registrations.
"""
model = WEIRegistration
table_class = WEIRegistrationTable
def dispatch(self, request, *args, **kwargs):
self.club = WEIClub.objects.get(pk=self.kwargs["pk"])
return super().dispatch(request, *args, **kwargs)
def get_queryset(self, **kwargs):
qs = super().get_queryset(**kwargs).filter(wei=self.club, membership=None)
pattern = self.request.GET.get("search", "")
if not pattern:
return qs.none()
qs = qs.filter(
Q(user__first_name__iregex=pattern)
| Q(user__last_name__iregex=pattern)
| Q(user__note__alias__name__iregex="^" + pattern)
| Q(user__note__alias__normalized_name__iregex="^" + Alias.normalize(pattern))
)
return qs[:20]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["club"] = self.club
context["title"] = _("Find WEI Registration")
return context
class WEIUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView): class WEIUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
""" """
Update the information of the WEI. Update the information of the WEI.
@ -494,7 +567,7 @@ class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Update
def get_form(self, form_class=None): def get_form(self, form_class=None):
form = super().get_form(form_class) form = super().get_form(form_class)
del form.fields["user"] form.fields["user"].disabled = True
if not self.object.first_year: if not self.object.first_year:
del form.fields["information_json"] del form.fields["information_json"]
return form return form
@ -502,7 +575,7 @@ class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Update
def form_valid(self, form): def form_valid(self, form):
# If the membership is already validated, then we update the bus and the team (and the roles) # If the membership is already validated, then we update the bus and the team (and the roles)
if form.instance.is_validated: if form.instance.is_validated:
membership_form = WEIMembershipForm(self.request.POST) membership_form = WEIMembershipForm(self.request.POST, instance=form.instance.membership)
if not membership_form.is_valid(): if not membership_form.is_valid():
return self.form_invalid(form) return self.form_invalid(form)
membership_form.save() membership_form.save()
@ -534,14 +607,22 @@ class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Update
class WEIDeleteRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, DeleteView): class WEIDeleteRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, DeleteView):
"""
Delete a non-validated WEI registration
"""
model = WEIRegistration model = WEIRegistration
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
wei = self.get_object().wei object = self.get_object()
wei = object.wei
today = date.today() today = date.today()
# We can't delete a registration of a past WEI # We can't delete a registration of a past WEI
if today > wei.membership_end: if today > wei.membership_end:
return redirect(reverse_lazy('wei:wei_closed', args=(wei.pk,))) return redirect(reverse_lazy('wei:wei_closed', args=(wei.pk,)))
if not PermissionBackend.check_perm(self.request.user, "wei.delete_weiregistration", object):
raise PermissionDenied
return super().dispatch(request, *args, **kwargs) return super().dispatch(request, *args, **kwargs)
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-21 01:01+0200\n" "POT-Creation-Date: 2020-04-21 17:47+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -439,7 +439,7 @@ msgstr ""
msgid "fee" msgid "fee"
msgstr "" msgstr ""
#: apps/member/models.py:267 apps/member/views.py:500 apps/wei/views.py:645 #: apps/member/models.py:267 apps/member/views.py:500 apps/wei/views.py:726
msgid "User is not a member of the parent club" msgid "User is not a member of the parent club"
msgstr "" msgstr ""
@ -482,7 +482,7 @@ msgstr ""
msgid "Search user" msgid "Search user"
msgstr "" msgstr ""
#: apps/member/views.py:495 apps/wei/views.py:636 #: apps/member/views.py:495 apps/wei/views.py:717
msgid "" msgid ""
"This user don't have enough money to join this club, and can't have a " "This user don't have enough money to join this club, and can't have a "
"negative balance." "negative balance."
@ -1000,7 +1000,7 @@ msgid "Remove"
msgstr "" msgstr ""
#: apps/wei/apps.py:10 apps/wei/models.py:44 apps/wei/models.py:45 #: apps/wei/apps.py:10 apps/wei/models.py:44 apps/wei/models.py:45
#: apps/wei/models.py:56 apps/wei/models.py:161 templates/base.html:115 #: apps/wei/models.py:56 apps/wei/models.py:161 templates/base.html:116
msgid "WEI" msgid "WEI"
msgstr "" msgstr ""
@ -1194,38 +1194,46 @@ msgstr ""
msgid "Validate" msgid "Validate"
msgstr "" msgstr ""
#: apps/wei/tables.py:110 templates/wei/bus_tables.html:26 #: apps/wei/tables.py:125 templates/wei/bus_tables.html:26
#: templates/wei/busteam_tables.html:43 #: templates/wei/busteam_tables.html:43
msgid "Teams" msgid "Teams"
msgstr "" msgstr ""
#: apps/wei/views.py:336 templates/wei/weiclub_info.html:62 #: apps/wei/views.py:165
msgid "Find WEI Membership"
msgstr ""
#: apps/wei/views.py:200
msgid "Find WEI Registration"
msgstr ""
#: apps/wei/views.py:409 templates/wei/weiclub_info.html:62
msgid "Register 1A" msgid "Register 1A"
msgstr "" msgstr ""
#: apps/wei/views.py:357 apps/wei/views.py:425 #: apps/wei/views.py:430 apps/wei/views.py:498
msgid "This user is already registered to this WEI." msgid "This user is already registered to this WEI."
msgstr "" msgstr ""
#: apps/wei/views.py:362 #: apps/wei/views.py:435
msgid "" msgid ""
"This user can't be in her/his first year since he/she has already participed " "This user can't be in her/his first year since he/she has already participed "
"to a WEI." "to a WEI."
msgstr "" msgstr ""
#: apps/wei/views.py:390 templates/wei/weiclub_info.html:63 #: apps/wei/views.py:463 templates/wei/weiclub_info.html:63
msgid "Register 2A+" msgid "Register 2A+"
msgstr "" msgstr ""
#: apps/wei/views.py:408 apps/wei/views.py:491 #: apps/wei/views.py:481 apps/wei/views.py:564
msgid "You already opened an account in the Société générale." msgid "You already opened an account in the Société générale."
msgstr "" msgstr ""
#: apps/wei/views.py:640 #: apps/wei/views.py:721
msgid "This user didn't give her/his caution check." msgid "This user didn't give her/his caution check."
msgstr "" msgstr ""
#: apps/wei/views.py:708 apps/wei/views.py:728 apps/wei/views.py:738 #: apps/wei/views.py:789 apps/wei/views.py:809 apps/wei/views.py:819
#: templates/wei/survey.html:12 templates/wei/survey_closed.html:12 #: templates/wei/survey.html:12 templates/wei/survey_closed.html:12
#: templates/wei/survey_end.html:12 #: templates/wei/survey_end.html:12
msgid "Survey WEI" msgid "Survey WEI"
@ -1323,7 +1331,7 @@ msgstr ""
msgid "Registrations" msgid "Registrations"
msgstr "" msgstr ""
#: templates/base.html:153 #: templates/base.html:155
msgid "" msgid ""
"Your e-mail address is not validated. Please check your mail inbox and click " "Your e-mail address is not validated. Please check your mail inbox and click "
"on the validation link." "on the validation link."
@ -1425,7 +1433,7 @@ msgstr ""
msgid "Club listing" msgid "Club listing"
msgstr "" msgstr ""
#: templates/member/club_tables.html:7 templates/wei/weiclub_tables.html:92 #: templates/member/club_tables.html:7
msgid "Member of the Club" msgid "Member of the Club"
msgstr "" msgstr ""
@ -1892,6 +1900,10 @@ msgstr ""
msgid "Update my registration" msgid "Update my registration"
msgstr "" msgstr ""
#: templates/wei/weiclub_tables.html:92
msgid "Members of the WEI"
msgstr ""
#: templates/wei/weiclub_tables.html:120 #: templates/wei/weiclub_tables.html:120
msgid "Unvalidated registrations" msgid "Unvalidated registrations"
msgstr "" msgstr ""
@ -2000,6 +2012,14 @@ msgid ""
" " " "
msgstr "" msgstr ""
#: templates/wei/weimembership_list.html:18
msgid "There is no membership found with this pattern."
msgstr ""
#: templates/wei/weimembership_list.html:24
msgid "View unvalidated registrations..."
msgstr ""
#: templates/wei/weiregistration_confirm_delete.html:17 #: templates/wei/weiregistration_confirm_delete.html:17
msgid "This registration is already validated and can't be deleted." msgid "This registration is already validated and can't be deleted."
msgstr "" msgstr ""
@ -2008,5 +2028,13 @@ msgstr ""
#, python-format #, python-format
msgid "" msgid ""
"Are you sure you want to delete the registration of %(user)s for the WEI " "Are you sure you want to delete the registration of %(user)s for the WEI "
"%(wei_name)s? This action can't be undoed." "%(wei_name)s? This action can't be undone."
msgstr ""
#: templates/wei/weiregistration_list.html:18
msgid "There is no pre-registration found with this pattern."
msgstr ""
#: templates/wei/weiregistration_list.html:24
msgid "View validated memberships..."
msgstr "" msgstr ""

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-21 01:01+0200\n" "POT-Creation-Date: 2020-04-21 17:47+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -439,7 +439,7 @@ msgstr "l'adhésion finit le"
msgid "fee" msgid "fee"
msgstr "cotisation" msgstr "cotisation"
#: apps/member/models.py:267 apps/member/views.py:500 apps/wei/views.py:645 #: apps/member/models.py:267 apps/member/views.py:500 apps/wei/views.py:726
msgid "User is not a member of the parent club" msgid "User is not a member of the parent club"
msgstr "L'utilisateur n'est pas membre du club parent" msgstr "L'utilisateur n'est pas membre du club parent"
@ -482,7 +482,7 @@ msgstr "Un alias avec un nom similaire existe déjà."
msgid "Search user" msgid "Search user"
msgstr "Chercher un utilisateur" msgstr "Chercher un utilisateur"
#: apps/member/views.py:495 apps/wei/views.py:636 #: apps/member/views.py:495 apps/wei/views.py:717
msgid "" msgid ""
"This user don't have enough money to join this club, and can't have a " "This user don't have enough money to join this club, and can't have a "
"negative balance." "negative balance."
@ -1008,7 +1008,7 @@ msgid "Remove"
msgstr "supprimer" msgstr "supprimer"
#: apps/wei/apps.py:10 apps/wei/models.py:44 apps/wei/models.py:45 #: apps/wei/apps.py:10 apps/wei/models.py:44 apps/wei/models.py:45
#: apps/wei/models.py:56 apps/wei/models.py:161 templates/base.html:115 #: apps/wei/models.py:56 apps/wei/models.py:161 templates/base.html:116
msgid "WEI" msgid "WEI"
msgstr "WEI" msgstr "WEI"
@ -1217,20 +1217,28 @@ msgstr "adhésions au WEI"
msgid "Validate" msgid "Validate"
msgstr "Valider" msgstr "Valider"
#: apps/wei/tables.py:110 templates/wei/bus_tables.html:26 #: apps/wei/tables.py:125 templates/wei/bus_tables.html:26
#: templates/wei/busteam_tables.html:43 #: templates/wei/busteam_tables.html:43
msgid "Teams" msgid "Teams"
msgstr "Équipes" msgstr "Équipes"
#: apps/wei/views.py:336 templates/wei/weiclub_info.html:62 #: apps/wei/views.py:165
msgid "Find WEI Membership"
msgstr "Trouver une adhésion au WEI"
#: apps/wei/views.py:200
msgid "Find WEI Registration"
msgstr "Trouver une inscription au WEI"
#: apps/wei/views.py:409 templates/wei/weiclub_info.html:62
msgid "Register 1A" msgid "Register 1A"
msgstr "Inscrire un 1A" msgstr "Inscrire un 1A"
#: apps/wei/views.py:357 apps/wei/views.py:425 #: apps/wei/views.py:430 apps/wei/views.py:498
msgid "This user is already registered to this WEI." msgid "This user is already registered to this WEI."
msgstr "Cette personne est déjà inscrite au WEI." msgstr "Cette personne est déjà inscrite au WEI."
#: apps/wei/views.py:362 #: apps/wei/views.py:435
msgid "" msgid ""
"This user can't be in her/his first year since he/she has already participed " "This user can't be in her/his first year since he/she has already participed "
"to a WEI." "to a WEI."
@ -1238,19 +1246,19 @@ msgstr ""
"Cet utilisateur ne peut pas être en première année puisqu'iel a déjà " "Cet utilisateur ne peut pas être en première année puisqu'iel a déjà "
"participé à un WEI." "participé à un WEI."
#: apps/wei/views.py:390 templates/wei/weiclub_info.html:63 #: apps/wei/views.py:463 templates/wei/weiclub_info.html:63
msgid "Register 2A+" msgid "Register 2A+"
msgstr "Inscrire un 2A+" msgstr "Inscrire un 2A+"
#: apps/wei/views.py:408 apps/wei/views.py:491 #: apps/wei/views.py:481 apps/wei/views.py:564
msgid "You already opened an account in the Société générale." msgid "You already opened an account in the Société générale."
msgstr "Vous avez déjà ouvert un compte auprès de la société générale." msgstr "Vous avez déjà ouvert un compte auprès de la société générale."
#: apps/wei/views.py:640 #: apps/wei/views.py:721
msgid "This user didn't give her/his caution check." msgid "This user didn't give her/his caution check."
msgstr "Cet utilisateur n'a pas donné son chèque de caution." msgstr "Cet utilisateur n'a pas donné son chèque de caution."
#: apps/wei/views.py:708 apps/wei/views.py:728 apps/wei/views.py:738 #: apps/wei/views.py:789 apps/wei/views.py:809 apps/wei/views.py:819
#: templates/wei/survey.html:12 templates/wei/survey_closed.html:12 #: templates/wei/survey.html:12 templates/wei/survey_closed.html:12
#: templates/wei/survey_end.html:12 #: templates/wei/survey_end.html:12
msgid "Survey WEI" msgid "Survey WEI"
@ -1348,7 +1356,7 @@ msgstr "Clubs"
msgid "Registrations" msgid "Registrations"
msgstr "Inscriptions" msgstr "Inscriptions"
#: templates/base.html:153 #: templates/base.html:155
msgid "" msgid ""
"Your e-mail address is not validated. Please check your mail inbox and click " "Your e-mail address is not validated. Please check your mail inbox and click "
"on the validation link." "on the validation link."
@ -1454,7 +1462,7 @@ msgstr "Créer un club"
msgid "Club listing" msgid "Club listing"
msgstr "Liste des clubs" msgstr "Liste des clubs"
#: templates/member/club_tables.html:7 templates/wei/weiclub_tables.html:92 #: templates/member/club_tables.html:7
msgid "Member of the Club" msgid "Member of the Club"
msgstr "Membre du club" msgstr "Membre du club"
@ -1943,6 +1951,10 @@ msgstr "M'inscrire au WEI ! 2A+"
msgid "Update my registration" msgid "Update my registration"
msgstr "Mettre à jour mon inscription" msgstr "Mettre à jour mon inscription"
#: templates/wei/weiclub_tables.html:92
msgid "Members of the WEI"
msgstr "Membres du WEI"
#: templates/wei/weiclub_tables.html:120 #: templates/wei/weiclub_tables.html:120
msgid "Unvalidated registrations" msgid "Unvalidated registrations"
msgstr "Inscriptions non validées" msgstr "Inscriptions non validées"
@ -1973,15 +1985,15 @@ msgstr "chèque de caution donné"
#: templates/wei/weimembership_form.html:103 #: templates/wei/weimembership_form.html:103
msgid "preferred bus" msgid "preferred bus"
msgstr "" msgstr "bus préféré"
#: templates/wei/weimembership_form.html:106 #: templates/wei/weimembership_form.html:106
msgid "preferred team" msgid "preferred team"
msgstr "" msgstr "équipe préférée"
#: templates/wei/weimembership_form.html:109 #: templates/wei/weimembership_form.html:109
msgid "preferred roles" msgid "preferred roles"
msgstr "" msgstr "rôles préférés"
#: templates/wei/weimembership_form.html:117 #: templates/wei/weimembership_form.html:117
#: templates/wei/weiregistration_confirm_delete.html:31 #: templates/wei/weiregistration_confirm_delete.html:31
@ -2069,6 +2081,14 @@ msgstr ""
"l'inscription au WEI.\n" "l'inscription au WEI.\n"
" " " "
#: templates/wei/weimembership_list.html:18
msgid "There is no membership found with this pattern."
msgstr "Il n'y a pas d'adhésion trouvée avec cette entrée."
#: templates/wei/weimembership_list.html:24
msgid "View unvalidated registrations..."
msgstr "Voir les inscriptions non validées ..."
#: templates/wei/weiregistration_confirm_delete.html:17 #: templates/wei/weiregistration_confirm_delete.html:17
msgid "This registration is already validated and can't be deleted." msgid "This registration is already validated and can't be deleted."
msgstr "L'inscription a déjà été validée et ne peut pas être supprimée." msgstr "L'inscription a déjà été validée et ne peut pas être supprimée."
@ -2077,7 +2097,15 @@ msgstr "L'inscription a déjà été validée et ne peut pas être supprimée."
#, python-format #, python-format
msgid "" msgid ""
"Are you sure you want to delete the registration of %(user)s for the WEI " "Are you sure you want to delete the registration of %(user)s for the WEI "
"%(wei_name)s? This action can't be undoed." "%(wei_name)s? This action can't be undone."
msgstr "" msgstr ""
"Êtes-vous sûr de vouloir supprimer l'inscription de %(user)s pour le WEI " "Êtes-vous sûr de vouloir supprimer l'inscription de %(user)s pour le WEI "
"%(wei_name)s ? Cette action ne pourra pas être annulée." "%(wei_name)s ? Cette action ne pourra pas être annulée."
#: templates/wei/weiregistration_list.html:18
msgid "There is no pre-registration found with this pattern."
msgstr "Il n'y a pas de pré-inscription en attente avec cette entrée."
#: templates/wei/weiregistration_list.html:24
msgid "View validated memberships..."
msgstr "Voir les adhésions validées ..."

View File

@ -88,8 +88,8 @@
{% if member_list.data %} {% if member_list.data %}
<div class="card"> <div class="card">
<div class="card-header position-relative" id="clubListHeading"> <div class="card-header position-relative" id="clubListHeading">
<a class="btn btn-link stretched-link font-weight-bold"> <a class="btn btn-link stretched-link font-weight-bold" href="{% url "wei:wei_memberships" pk=club.pk %}">
<i class="fa fa-users"></i> {% trans "Member of the Club" %} <i class="fa fa-users"></i> {% trans "Members of the WEI" %}
</a> </a>
</div> </div>
{% render_table member_list %} {% render_table member_list %}
@ -116,7 +116,7 @@
{% if pre_registrations.data %} {% if pre_registrations.data %}
<div class="card"> <div class="card">
<div class="card-header position-relative" id="historyListHeading"> <div class="card-header position-relative" id="historyListHeading">
<a class="btn btn-link stretched-link font-weight-bold"> <a class="btn btn-link stretched-link font-weight-bold" href="{% url 'wei:wei_registrations' pk=club.pk %}">
<i class="fa fa-user-plus"></i> {% trans "Unvalidated registrations" %} <i class="fa fa-user-plus"></i> {% trans "Unvalidated registrations" %}
</a> </a>
</div> </div>

View File

@ -0,0 +1,46 @@
{% extends "member/noteowner_detail.html" %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% block profile_info %}
{% include "wei/weiclub_info.html" %}
{% endblock %}
{% block profile_content %}
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note/bus/équipe ...">
<hr>
<div id="memberships_table">
{% if table.data %}
{% render_table table %}
{% else %}
<div class="alert alert-warning">
{% trans "There is no membership found with this pattern." %}
</div>
{% endif %}
</div>
<a href="{% url 'wei:wei_registrations' pk=club.pk %}">
<button class="btn btn-block btn-info">{% trans "View unvalidated registrations..." %}</button>
</a>
{% endblock %}
{% block extrajavascript %}
<script type="text/javascript">
$(document).ready(function() {
let old_pattern = null;
let searchbar_obj = $("#searchbar");
function reloadTable() {
let pattern = searchbar_obj.val();
if (pattern === old_pattern)
return;
$("#memberships_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #memberships_table");
}
searchbar_obj.keyup(reloadTable);
});
</script>
{% endblock %}

View File

@ -21,7 +21,7 @@
<div class="card-body"> <div class="card-body">
<div class="alert alert-warning"> <div class="alert alert-warning">
{% with user=object.user wei_name=object.wei.name %} {% with user=object.user wei_name=object.wei.name %}
{% blocktrans %}Are you sure you want to delete the registration of {{ user }} for the WEI {{ wei_name }}? This action can't be undoed.{% endblocktrans %} {% blocktrans %}Are you sure you want to delete the registration of {{ user }} for the WEI {{ wei_name }}? This action can't be undone.{% endblocktrans %}
{% endwith %} {% endwith %}
</div> </div>
</div> </div>

View File

@ -0,0 +1,46 @@
{% extends "member/noteowner_detail.html" %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% block profile_info %}
{% include "wei/weiclub_info.html" %}
{% endblock %}
{% block profile_content %}
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note ...">
<hr>
<div id="registrations_table">
{% if table.data %}
{% render_table table %}
{% else %}
<div class="alert alert-warning">
{% trans "There is no pre-registration found with this pattern." %}
</div>
{% endif %}
</div>
<a href="{% url 'wei:wei_memberships' pk=club.pk %}">
<button class="btn btn-block btn-info">{% trans "View validated memberships..." %}</button>
</a>
{% endblock %}
{% block extrajavascript %}
<script type="text/javascript">
$(document).ready(function() {
let old_pattern = null;
let searchbar_obj = $("#searchbar");
function reloadTable() {
let pattern = searchbar_obj.val();
if (pattern === old_pattern)
return;
$("#registrations_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #registrations_table");
}
searchbar_obj.keyup(reloadTable);
});
</script>
{% endblock %}