mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-12-23 07:52:23 +00:00
Rename join_BDE and join_Kfet to lowercase
This commit is contained in:
parent
5ab8beecef
commit
21219b9c62
@ -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,
|
||||
|
@ -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 %}
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@ -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()
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user