mirror of https://gitlab.crans.org/bde/nk20
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,
|
required=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
join_BDE = forms.BooleanField(
|
join_bde = forms.BooleanField(
|
||||||
label=_("Join BDE Club"),
|
label=_("Join BDE Club"),
|
||||||
required=False,
|
required=False,
|
||||||
initial=True,
|
initial=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# The user can join the Kfet club at the inscription
|
# The user can join the Kfet club at the inscription
|
||||||
join_Kfet = forms.BooleanField(
|
join_kfet = forms.BooleanField(
|
||||||
label=_("Join Kfet Club"),
|
label=_("Join Kfet Club"),
|
||||||
required=False,
|
required=False,
|
||||||
initial=True,
|
initial=True,
|
||||||
|
|
|
@ -100,13 +100,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
bank.attr('disabled', true);
|
bank.attr('disabled', true);
|
||||||
bank.val('Société générale');
|
bank.val('Société générale');
|
||||||
|
|
||||||
let join_BDE = $("#id_join_BDE");
|
let join_bde = $("#id_join_bde");
|
||||||
join_BDE.attr('disabled', true);
|
|
||||||
join_BDE.attr('checked', 'checked');
|
|
||||||
|
|
||||||
let join_Kfet = $("#id_join_Kfet");
|
join_bde.attr('disabled', true);
|
||||||
join_Kfet.attr('disabled', true);
|
join_bde.attr('checked', 'checked');
|
||||||
join_Kfet.attr('checked', 'checked');
|
|
||||||
|
let join_kfet = $("#id_join_kfet");
|
||||||
|
join_kfet.attr('disabled', true);
|
||||||
|
join_kfet.attr('checked', 'checked');
|
||||||
}
|
}
|
||||||
|
|
||||||
soge_field.change(fillFields);
|
soge_field.change(fillFields);
|
||||||
|
@ -116,4 +117,4 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
fillFields();
|
fillFields();
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -196,8 +196,8 @@ class TestValidateRegistration(TestCase):
|
||||||
last_name="TOTO",
|
last_name="TOTO",
|
||||||
first_name="Toto",
|
first_name="Toto",
|
||||||
bank="Société générale",
|
bank="Société générale",
|
||||||
join_BDE=False,
|
join_bde=False,
|
||||||
join_Kfet=False,
|
join_kfet=False,
|
||||||
))
|
))
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertTrue(response.context["form"].errors)
|
self.assertTrue(response.context["form"].errors)
|
||||||
|
@ -210,8 +210,8 @@ class TestValidateRegistration(TestCase):
|
||||||
last_name="TOTO",
|
last_name="TOTO",
|
||||||
first_name="Toto",
|
first_name="Toto",
|
||||||
bank="Société générale",
|
bank="Société générale",
|
||||||
join_BDE=False,
|
join_bde=False,
|
||||||
join_Kfet=True,
|
join_kfet=True,
|
||||||
))
|
))
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertTrue(response.context["form"].errors)
|
self.assertTrue(response.context["form"].errors)
|
||||||
|
@ -224,8 +224,8 @@ class TestValidateRegistration(TestCase):
|
||||||
last_name="TOTO",
|
last_name="TOTO",
|
||||||
first_name="Toto",
|
first_name="Toto",
|
||||||
bank="J'ai pas d'argent",
|
bank="J'ai pas d'argent",
|
||||||
join_BDE=True,
|
join_bde=True,
|
||||||
join_Kfet=True,
|
join_kfet=True,
|
||||||
))
|
))
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertTrue(response.context["form"].errors)
|
self.assertTrue(response.context["form"].errors)
|
||||||
|
@ -238,8 +238,8 @@ class TestValidateRegistration(TestCase):
|
||||||
last_name="",
|
last_name="",
|
||||||
first_name="",
|
first_name="",
|
||||||
bank="",
|
bank="",
|
||||||
join_BDE=True,
|
join_bde=True,
|
||||||
join_Kfet=True,
|
join_kfet=True,
|
||||||
))
|
))
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertTrue(response.context["form"].errors)
|
self.assertTrue(response.context["form"].errors)
|
||||||
|
@ -255,8 +255,8 @@ class TestValidateRegistration(TestCase):
|
||||||
last_name="TOTO",
|
last_name="TOTO",
|
||||||
first_name="Toto",
|
first_name="Toto",
|
||||||
bank="Société générale",
|
bank="Société générale",
|
||||||
join_BDE=True,
|
join_bde=True,
|
||||||
join_Kfet=False,
|
join_kfet=False,
|
||||||
))
|
))
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertTrue(response.context["form"].errors)
|
self.assertTrue(response.context["form"].errors)
|
||||||
|
@ -281,8 +281,8 @@ class TestValidateRegistration(TestCase):
|
||||||
last_name="TOTO",
|
last_name="TOTO",
|
||||||
first_name="Toto",
|
first_name="Toto",
|
||||||
bank="Société générale",
|
bank="Société générale",
|
||||||
join_BDE=True,
|
join_bde=True,
|
||||||
join_Kfet=False,
|
join_kfet=False,
|
||||||
))
|
))
|
||||||
self.assertRedirects(response, self.user.profile.get_absolute_url(), 302, 200)
|
self.assertRedirects(response, self.user.profile.get_absolute_url(), 302, 200)
|
||||||
self.user.profile.refresh_from_db()
|
self.user.profile.refresh_from_db()
|
||||||
|
@ -317,8 +317,8 @@ class TestValidateRegistration(TestCase):
|
||||||
last_name="TOTO",
|
last_name="TOTO",
|
||||||
first_name="Toto",
|
first_name="Toto",
|
||||||
bank="Société générale",
|
bank="Société générale",
|
||||||
join_BDE=True,
|
join_bde=True,
|
||||||
join_Kfet=True,
|
join_kfet=True,
|
||||||
))
|
))
|
||||||
self.assertRedirects(response, self.user.profile.get_absolute_url(), 302, 200)
|
self.assertRedirects(response, self.user.profile.get_absolute_url(), 302, 200)
|
||||||
self.user.profile.refresh_from_db()
|
self.user.profile.refresh_from_db()
|
||||||
|
@ -353,8 +353,8 @@ class TestValidateRegistration(TestCase):
|
||||||
last_name="TOTO",
|
last_name="TOTO",
|
||||||
first_name="Toto",
|
first_name="Toto",
|
||||||
bank="Société générale",
|
bank="Société générale",
|
||||||
join_BDE=True,
|
join_bde=True,
|
||||||
join_Kfet=True,
|
join_kfet=True,
|
||||||
))
|
))
|
||||||
self.assertRedirects(response, self.user.profile.get_absolute_url(), 302, 200)
|
self.assertRedirects(response, self.user.profile.get_absolute_url(), 302, 200)
|
||||||
self.user.profile.refresh_from_db()
|
self.user.profile.refresh_from_db()
|
||||||
|
|
|
@ -261,26 +261,26 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
|
||||||
last_name = form.cleaned_data["last_name"]
|
last_name = form.cleaned_data["last_name"]
|
||||||
first_name = form.cleaned_data["first_name"]
|
first_name = form.cleaned_data["first_name"]
|
||||||
bank = form.cleaned_data["bank"]
|
bank = form.cleaned_data["bank"]
|
||||||
join_BDE = form.cleaned_data["join_BDE"]
|
join_bde = form.cleaned_data["join_bde"]
|
||||||
join_Kfet = form.cleaned_data["join_Kfet"]
|
join_kfet = form.cleaned_data["join_kfet"]
|
||||||
|
|
||||||
if soge:
|
if soge:
|
||||||
# If Société Générale pays the inscription, the user joins the two clubs
|
# If Société Générale pays the inscription, the user joins the two clubs
|
||||||
join_BDE = True
|
join_bde = True
|
||||||
join_Kfet = True
|
join_kfet = True
|
||||||
|
|
||||||
if not join_BDE:
|
if not join_bde:
|
||||||
form.add_error('join_BDE', _("You must join the BDE."))
|
form.add_error('join_bde', _("You must join the BDE."))
|
||||||
return super().form_invalid(form)
|
return super().form_invalid(form)
|
||||||
|
|
||||||
fee = 0
|
fee = 0
|
||||||
bde = Club.objects.get(name="BDE")
|
bde = Club.objects.get(name="BDE")
|
||||||
bde_fee = bde.membership_fee_paid if user.profile.paid else bde.membership_fee_unpaid
|
bde_fee = bde.membership_fee_paid if user.profile.paid else bde.membership_fee_unpaid
|
||||||
if join_BDE:
|
if join_bde:
|
||||||
fee += bde_fee
|
fee += bde_fee
|
||||||
kfet = Club.objects.get(name="Kfet")
|
kfet = Club.objects.get(name="Kfet")
|
||||||
kfet_fee = kfet.membership_fee_paid if user.profile.paid else kfet.membership_fee_unpaid
|
kfet_fee = kfet.membership_fee_paid if user.profile.paid else kfet.membership_fee_unpaid
|
||||||
if join_Kfet:
|
if join_kfet:
|
||||||
fee += kfet_fee
|
fee += kfet_fee
|
||||||
|
|
||||||
if soge:
|
if soge:
|
||||||
|
@ -338,7 +338,7 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
|
||||||
valid=True,
|
valid=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
if join_BDE:
|
if join_bde:
|
||||||
# Create membership for the user to the BDE starting today
|
# Create membership for the user to the BDE starting today
|
||||||
membership = Membership(
|
membership = Membership(
|
||||||
club=bde,
|
club=bde,
|
||||||
|
@ -352,7 +352,7 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
|
||||||
membership.roles.add(Role.objects.get(name="Adhérent BDE"))
|
membership.roles.add(Role.objects.get(name="Adhérent BDE"))
|
||||||
membership.save()
|
membership.save()
|
||||||
|
|
||||||
if join_Kfet:
|
if join_kfet:
|
||||||
# Create membership for the user to the Kfet starting today
|
# Create membership for the user to the Kfet starting today
|
||||||
membership = Membership(
|
membership = Membership(
|
||||||
club=kfet,
|
club=kfet,
|
||||||
|
|
Loading…
Reference in New Issue