diff --git a/apps/wei/tables.py b/apps/wei/tables.py index 2565bcbc..d3c4e14f 100644 --- a/apps/wei/tables.py +++ b/apps/wei/tables.py @@ -172,7 +172,7 @@ class WEIMembershipTable(tables.Table): class WEIRegistration1ATable(tables.Table): user = tables.LinkColumn( - 'wei:wei_update_registration', + 'wei:wei_bus_1A', args=[A('pk')], ) diff --git a/apps/wei/templates/wei/attribute_bus_1A.html b/apps/wei/templates/wei/attribute_bus_1A.html new file mode 100644 index 00000000..dbfb6494 --- /dev/null +++ b/apps/wei/templates/wei/attribute_bus_1A.html @@ -0,0 +1,60 @@ +{% extends "wei/base.html" %} + +{% load i18n %} + +{% block profile_content %} +
+
+

{% trans "Bus attribution" %}

+
+ +
+
+
{% trans 'user'|capfirst %}
+
{{ object.user }}
+ +
{% trans 'last name'|capfirst %}
+
{{ object.user.last_name }}
+ +
{% trans 'first name'|capfirst %}
+
{{ object.user.first_name }}
+ +
{% trans 'gender'|capfirst %}
+
{{ object.get_gender_display }}
+ +
{% trans 'department'|capfirst %}
+
{{ object.user.profile.get_department_display }}
+ +
{% trans 'health issues'|capfirst %}
+
{{ object.health_issues|default:"—" }}
+ +
{% trans 'suggested bus'|capfirst %}
+
{{ survey.information.selected_bus_name }}
+
+ +
+
+ +
+
+
+ {% for key, value in survey.registration.information.items %} +
{{ key }}
+
{{ value }}
+ {% endfor %} +
+
+
+ +
+ + {% for bus, score in survey.ordered_buses %} + + {% endfor %} + + {% trans "Back to main list" %} +
+
+{% endblock %} diff --git a/apps/wei/templates/wei/weimembership_form.html b/apps/wei/templates/wei/weimembership_form.html index 1225175d..7d1059b7 100644 --- a/apps/wei/templates/wei/weimembership_form.html +++ b/apps/wei/templates/wei/weimembership_form.html @@ -53,7 +53,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
{{ registration.first_year|yesno }}
{% trans 'gender'|capfirst %}
-
{{ registration.gender }}
+
{{ registration.get_gender_display }}
{% trans 'clothing cut'|capfirst %}
{{ registration.clothing_cut }}
diff --git a/apps/wei/urls.py b/apps/wei/urls.py index e75e3452..ff6e88c5 100644 --- a/apps/wei/urls.py +++ b/apps/wei/urls.py @@ -3,12 +3,11 @@ from django.urls import path -from .views import CurrentWEIDetailView, WEI1AListView, WEIListView, WEICreateView, WEIDetailView, WEIUpdateView,\ - WEIRegistrationsView, WEIMembershipsView, MemberListRenderView,\ - BusCreateView, BusManageView, BusUpdateView, BusTeamCreateView, BusTeamManageView, BusTeamUpdateView,\ - WEIRegister1AView, WEIRegister2AView, WEIUpdateRegistrationView, WEIDeleteRegistrationView,\ - WEIValidateRegistrationView, WEISurveyView, WEISurveyEndView, WEIClosedView - +from .views import CurrentWEIDetailView, WEI1AListView, WEIListView, WEICreateView, WEIDetailView, WEIUpdateView, \ + WEIRegistrationsView, WEIMembershipsView, MemberListRenderView, \ + BusCreateView, BusManageView, BusUpdateView, BusTeamCreateView, BusTeamManageView, BusTeamUpdateView, \ + WEIAttributeBus1AView, WEIRegister1AView, WEIRegister2AView, WEIUpdateRegistrationView, \ + WEIDeleteRegistrationView, WEIValidateRegistrationView, WEISurveyView, WEISurveyEndView, WEIClosedView app_name = 'wei' urlpatterns = [ @@ -24,7 +23,7 @@ urlpatterns = [ name="wei_memberships_bus_pdf"), path('detail//memberships/pdf///', MemberListRenderView.as_view(), name="wei_memberships_team_pdf"), - path('bus-1A-list//', WEI1AListView.as_view(), name="wei_1A_list"), + path('bus-1A/list//', WEI1AListView.as_view(), name="wei_1A_list"), path('add-bus//', BusCreateView.as_view(), name="add_bus"), path('manage-bus//', BusManageView.as_view(), name="manage_bus"), path('update-bus//', BusUpdateView.as_view(), name="update_bus"), @@ -41,4 +40,5 @@ urlpatterns = [ path('survey//', WEISurveyView.as_view(), name="wei_survey"), path('survey//end/', WEISurveyEndView.as_view(), name="wei_survey_end"), path('detail//closed/', WEIClosedView.as_view(), name="wei_closed"), + path('bus-1A//', WEIAttributeBus1AView.as_view(), name="wei_bus_1A"), ] diff --git a/apps/wei/views.py b/apps/wei/views.py index baf4dba9..2b3a752c 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -1182,3 +1182,20 @@ class WEI1AListView(LoginRequiredMixin, ProtectQuerysetMixin, SingleTableView): context['club'] = self.club context['bus_repartition_table'] = BusRepartitionTable(Bus.objects.filter(wei=self.club, size__gt=0).all()) return context + + +class WEIAttributeBus1AView(ProtectQuerysetMixin, DetailView): + model = WEIRegistration + template_name = "wei/attribute_bus_1A.html" + extra_context = {"title": _("Attribute bus")} + + def get_queryset(self, filter_permissions=True, **kwargs): + qs = super().get_queryset(filter_permissions, **kwargs) + qs = qs.filter(first_year=True) + return qs + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context['club'] = self.object.wei + context['survey'] = CurrentSurvey(self.object) + return context diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 4adb6f95..7d71955d 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-11 19:00+0200\n" +"POT-Creation-Date: 2021-09-12 19:30+0200\n" "PO-Revision-Date: 2020-11-16 20:02+0000\n" "Last-Translator: Yohann D'ANELLO \n" "Language-Team: French \n" @@ -112,7 +112,8 @@ msgstr "type" #: apps/activity/models.py:89 apps/logs/models.py:22 apps/member/models.py:305 #: apps/note/models/notes.py:148 apps/treasury/models.py:285 -#: apps/wei/models.py:165 apps/wei/templates/wei/survey.html:15 +#: apps/wei/models.py:165 apps/wei/templates/wei/attribute_bus_1A.html:13 +#: apps/wei/templates/wei/survey.html:15 msgid "user" msgstr "utilisateur" @@ -204,6 +205,7 @@ msgstr "La note est en négatif." #: apps/activity/models.py:240 #: apps/treasury/templates/treasury/sogecredit_detail.html:14 +#: apps/wei/templates/wei/attribute_bus_1A.html:16 msgid "last name" msgstr "nom de famille" @@ -211,6 +213,7 @@ msgstr "nom de famille" #: apps/member/templates/member/includes/profile_info.html:4 #: apps/registration/templates/registration/future_profile_detail.html:16 #: apps/treasury/templates/treasury/sogecredit_detail.html:17 +#: apps/wei/templates/wei/attribute_bus_1A.html:19 #: apps/wei/templates/wei/weimembership_form.html:14 msgid "first name" msgstr "prénom" @@ -620,7 +623,8 @@ msgstr "section" msgid "e.g. \"1A0\", \"9A♥\", \"SAPHIRE\"" msgstr "e.g. \"1A0\", \"9A♥\", \"SAPHIRE\"" -#: apps/member/models.py:54 apps/wei/templates/wei/weimembership_form.html:32 +#: apps/member/models.py:54 apps/wei/templates/wei/attribute_bus_1A.html:25 +#: apps/wei/templates/wei/weimembership_form.html:32 msgid "department" msgstr "département" @@ -2637,7 +2641,8 @@ msgstr "Femme" msgid "Non binary" msgstr "Non-binaire" -#: apps/wei/models.py:196 apps/wei/templates/wei/weimembership_form.html:55 +#: apps/wei/models.py:196 apps/wei/templates/wei/attribute_bus_1A.html:22 +#: apps/wei/templates/wei/weimembership_form.html:55 msgid "gender" msgstr "genre" @@ -2649,7 +2654,8 @@ msgstr "coupe de vêtement" msgid "clothing size" msgstr "taille de vêtement" -#: apps/wei/models.py:224 apps/wei/templates/wei/weimembership_form.html:67 +#: apps/wei/models.py:224 apps/wei/templates/wei/attribute_bus_1A.html:28 +#: apps/wei/templates/wei/weimembership_form.html:67 msgid "health issues" msgstr "problèmes de santé" @@ -2766,6 +2772,22 @@ msgstr "Attribuer les 1A dans les bus" msgid "Start attribution!" msgstr "Démarrer l'attribution !" +#: apps/wei/templates/wei/attribute_bus_1A.html:8 +msgid "Bus attribution" +msgstr "Répartition des bus" + +#: apps/wei/templates/wei/attribute_bus_1A.html:31 +msgid "suggested bus" +msgstr "bus suggéré" + +#: apps/wei/templates/wei/attribute_bus_1A.html:37 +msgid "View raw survey information" +msgstr "Voir les informations brutes du sondage" + +#: apps/wei/templates/wei/attribute_bus_1A.html:57 +msgid "Back to main list" +msgstr "Retour à la liste principale" + #: apps/wei/templates/wei/base.html:44 msgid "WEI fee (paid students)" msgstr "Prix du WEI (élèves)" @@ -3094,6 +3116,10 @@ msgstr "Valider l'inscription WEI" msgid "Attribute buses to first year members" msgstr "Répartir les 1A dans les bus" +#: apps/wei/views.py:1190 +msgid "Attribute bus" +msgstr "Attribuer un bus" + #: note_kfet/settings/base.py:161 msgid "German" msgstr "Allemand"