From 21219b9c6250d0dc55614d2072402ee2f12d0198 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 5 May 2021 19:46:53 +0200 Subject: [PATCH] Rename join_BDE and join_Kfet to lowercase --- apps/registration/forms.py | 4 +-- .../registration/future_profile_detail.html | 15 +++++---- apps/registration/tests/test_registration.py | 32 +++++++++---------- apps/registration/views.py | 20 ++++++------ 4 files changed, 36 insertions(+), 35 deletions(-) diff --git a/apps/registration/forms.py b/apps/registration/forms.py index abb2aaac..90621997 100644 --- a/apps/registration/forms.py +++ b/apps/registration/forms.py @@ -101,14 +101,14 @@ class ValidationForm(forms.Form): required=False, ) - join_BDE = forms.BooleanField( + join_bde = forms.BooleanField( label=_("Join BDE Club"), required=False, initial=True, ) # The user can join the Kfet club at the inscription - join_Kfet = forms.BooleanField( + join_kfet = forms.BooleanField( label=_("Join Kfet Club"), required=False, initial=True, diff --git a/apps/registration/templates/registration/future_profile_detail.html b/apps/registration/templates/registration/future_profile_detail.html index d8f061c0..577ad219 100644 --- a/apps/registration/templates/registration/future_profile_detail.html +++ b/apps/registration/templates/registration/future_profile_detail.html @@ -100,13 +100,14 @@ SPDX-License-Identifier: GPL-3.0-or-later bank.attr('disabled', true); bank.val('Société générale'); - let join_BDE = $("#id_join_BDE"); - join_BDE.attr('disabled', true); - join_BDE.attr('checked', 'checked'); + let join_bde = $("#id_join_bde"); - let join_Kfet = $("#id_join_Kfet"); - join_Kfet.attr('disabled', true); - join_Kfet.attr('checked', 'checked'); + join_bde.attr('disabled', true); + join_bde.attr('checked', 'checked'); + + let join_kfet = $("#id_join_kfet"); + join_kfet.attr('disabled', true); + join_kfet.attr('checked', 'checked'); } soge_field.change(fillFields); @@ -116,4 +117,4 @@ SPDX-License-Identifier: GPL-3.0-or-later fillFields(); {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/apps/registration/tests/test_registration.py b/apps/registration/tests/test_registration.py index adb773f9..ebafba53 100644 --- a/apps/registration/tests/test_registration.py +++ b/apps/registration/tests/test_registration.py @@ -196,8 +196,8 @@ class TestValidateRegistration(TestCase): last_name="TOTO", first_name="Toto", bank="Société générale", - join_BDE=False, - join_Kfet=False, + join_bde=False, + join_kfet=False, )) self.assertEqual(response.status_code, 200) self.assertTrue(response.context["form"].errors) @@ -210,8 +210,8 @@ class TestValidateRegistration(TestCase): last_name="TOTO", first_name="Toto", bank="Société générale", - join_BDE=False, - join_Kfet=True, + join_bde=False, + join_kfet=True, )) self.assertEqual(response.status_code, 200) self.assertTrue(response.context["form"].errors) @@ -224,8 +224,8 @@ class TestValidateRegistration(TestCase): last_name="TOTO", first_name="Toto", bank="J'ai pas d'argent", - join_BDE=True, - join_Kfet=True, + join_bde=True, + join_kfet=True, )) self.assertEqual(response.status_code, 200) self.assertTrue(response.context["form"].errors) @@ -238,8 +238,8 @@ class TestValidateRegistration(TestCase): last_name="", first_name="", bank="", - join_BDE=True, - join_Kfet=True, + join_bde=True, + join_kfet=True, )) self.assertEqual(response.status_code, 200) self.assertTrue(response.context["form"].errors) @@ -255,8 +255,8 @@ class TestValidateRegistration(TestCase): last_name="TOTO", first_name="Toto", bank="Société générale", - join_BDE=True, - join_Kfet=False, + join_bde=True, + join_kfet=False, )) self.assertEqual(response.status_code, 200) self.assertTrue(response.context["form"].errors) @@ -281,8 +281,8 @@ class TestValidateRegistration(TestCase): last_name="TOTO", first_name="Toto", bank="Société générale", - join_BDE=True, - join_Kfet=False, + join_bde=True, + join_kfet=False, )) self.assertRedirects(response, self.user.profile.get_absolute_url(), 302, 200) self.user.profile.refresh_from_db() @@ -317,8 +317,8 @@ class TestValidateRegistration(TestCase): last_name="TOTO", first_name="Toto", bank="Société générale", - join_BDE=True, - join_Kfet=True, + join_bde=True, + join_kfet=True, )) self.assertRedirects(response, self.user.profile.get_absolute_url(), 302, 200) self.user.profile.refresh_from_db() @@ -353,8 +353,8 @@ class TestValidateRegistration(TestCase): last_name="TOTO", first_name="Toto", bank="Société générale", - join_BDE=True, - join_Kfet=True, + join_bde=True, + join_kfet=True, )) self.assertRedirects(response, self.user.profile.get_absolute_url(), 302, 200) self.user.profile.refresh_from_db() diff --git a/apps/registration/views.py b/apps/registration/views.py index 3c2ea0a7..c0c32d15 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -261,26 +261,26 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, last_name = form.cleaned_data["last_name"] first_name = form.cleaned_data["first_name"] bank = form.cleaned_data["bank"] - join_BDE = form.cleaned_data["join_BDE"] - join_Kfet = form.cleaned_data["join_Kfet"] + join_bde = form.cleaned_data["join_bde"] + join_kfet = form.cleaned_data["join_kfet"] if soge: # If Société Générale pays the inscription, the user joins the two clubs - join_BDE = True - join_Kfet = True + join_bde = True + join_kfet = True - if not join_BDE: - form.add_error('join_BDE', _("You must join the BDE.")) + if not join_bde: + form.add_error('join_bde', _("You must join the BDE.")) return super().form_invalid(form) fee = 0 bde = Club.objects.get(name="BDE") bde_fee = bde.membership_fee_paid if user.profile.paid else bde.membership_fee_unpaid - if join_BDE: + if join_bde: fee += bde_fee kfet = Club.objects.get(name="Kfet") kfet_fee = kfet.membership_fee_paid if user.profile.paid else kfet.membership_fee_unpaid - if join_Kfet: + if join_kfet: fee += kfet_fee if soge: @@ -338,7 +338,7 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, valid=True, ) - if join_BDE: + if join_bde: # Create membership for the user to the BDE starting today membership = Membership( club=bde, @@ -352,7 +352,7 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin, membership.roles.add(Role.objects.get(name="Adhérent BDE")) membership.save() - if join_Kfet: + if join_kfet: # Create membership for the user to the Kfet starting today membership = Membership( club=kfet,