diff --git a/apps/member/models.py b/apps/member/models.py index b4b9b95759b1a6ff0d422b4b34ae4aa2bc2d9376..20f50591c13cb1b82e0ac3631c04102811ea7313 100644 --- a/apps/member/models.py +++ b/apps/member/models.py @@ -92,6 +92,28 @@ class Profile(models.Model): default=False, ) + ml_events_registration = models.BooleanField( + blank=True, + null=True, + default=None, + choices=[ + (None, _("No")), + ('fr', _("Yes (receive them in french)")), + ('en', _("Yes (receive them in english)")), + ], + verbose_name=_("Register on the mailing list to stay informed of the events of the campus (1 mail/week)"), + ) + + ml_sport_registration = models.BooleanField( + default=False, + verbose_name=_("Register on the mailing list to stay informed of the sport events of the campus (1 mail/week)"), + ) + + ml_art_registration = models.BooleanField( + default=False, + verbose_name=_("Register on the mailing list to stay informed of the art events of the campus (1 mail/week)"), + ) + report_frequency = models.PositiveSmallIntegerField( verbose_name=_("report frequency (in days)"), default=0, diff --git a/apps/wei/management/commands/extract_ml_registrations.py b/apps/wei/management/commands/extract_ml_registrations.py index b67bf10b2f723624db36afee3cfbea5dede32b4e..6d48093e7a230e943c6743dd28fca6bfff9360c3 100644 --- a/apps/wei/management/commands/extract_ml_registrations.py +++ b/apps/wei/management/commands/extract_ml_registrations.py @@ -5,6 +5,7 @@ from datetime import date from django.core.management import BaseCommand from django.db.models import Q + from member.models import Membership, Club from wei.models import WEIClub @@ -21,6 +22,13 @@ class Command(BaseCommand): help='Select the year of the concerned WEI. Default: last year') def handle(self, *args, **options): + ########################################################### + # WARNING # + ########################################################### + # + # This code is obsolete. + # TODO: Improve the mailing list extraction system, and link it automatically with Mailman. + if options["type"] == "members": for membership in Membership.objects.filter( club__name="BDE", diff --git a/apps/wei/models.py b/apps/wei/models.py index b72208ed2dc025abf113f4eb6a92b4e5c476636d..46d9383f1c8ccdd2f580330b5b9fcb29e91ed2cb 100644 --- a/apps/wei/models.py +++ b/apps/wei/models.py @@ -229,21 +229,6 @@ class WEIRegistration(models.Model): verbose_name=_("emergency contact phone"), ) - ml_events_registration = models.BooleanField( - default=False, - verbose_name=_("Register on the mailing list to stay informed of the events of the campus (1 mail/week)"), - ) - - ml_sport_registration = models.BooleanField( - default=False, - verbose_name=_("Register on the mailing list to stay informed of the sport events of the campus (1 mail/week)"), - ) - - ml_art_registration = models.BooleanField( - default=False, - verbose_name=_("Register on the mailing list to stay informed of the art events of the campus (1 mail/week)"), - ) - first_year = models.BooleanField( default=False, verbose_name=_("first year"), diff --git a/apps/wei/templates/wei/weimembership_form.html b/apps/wei/templates/wei/weimembership_form.html index 1fc4e43ca8aa3e8182e60c4191fbb9823e99b543..9a1a4d97b7c02f3f67fa8f5b2d5898d9b0844838 100644 --- a/apps/wei/templates/wei/weimembership_form.html +++ b/apps/wei/templates/wei/weimembership_form.html @@ -77,15 +77,6 @@ <dt class="col-xl-6">{% trans 'emergency contact phone'|capfirst %}</dt> <dd class="col-xl-6">{{ registration.emergency_contact_phone }}</dd> - <dt class="col-xl-6">{% trans 'Register on the mailing list to stay informed of the events of the campus (1 mail/week)' %}</dt> - <dd class="col-xl-6">{{ registration.ml_events_registration|yesno }}</dd> - - <dt class="col-xl-6">{% trans 'Register on the mailing list to stay informed of the sport events of the campus (1 mail/week)' %}</dt> - <dd class="col-xl-6">{{ registration.ml_sport_registration|yesno }}</dd> - - <dt class="col-xl-6">{% trans 'Register on the mailing list to stay informed of the art events of the campus (1 mail/week)' %}</dt> - <dd class="col-xl-6">{{ registration.ml_art_registration|yesno }}</dd> - <dt class="col-xl-6">{% trans 'Payment from Société générale' %}</dt> <dd class="col-xl-6">{{ registration.soge_credit|yesno }}</dd> diff --git a/apps/wei/tests/test_wei_registration.py b/apps/wei/tests/test_wei_registration.py index f09ae6045640cd4b9928640ea64b496f623c29a3..de14c8b343e2d8c37038b4c34d46573d166b898b 100644 --- a/apps/wei/tests/test_wei_registration.py +++ b/apps/wei/tests/test_wei_registration.py @@ -99,9 +99,6 @@ class TestWEIRegistration(TestCase): health_issues="I am a bot", emergency_contact_name="Pikachu", emergency_contact_phone="+33123456789", - ml_events_registration=True, - ml_sport_registration=True, - ml_art_registration=True, first_year=False, ) @@ -387,9 +384,6 @@ class TestWEIRegistration(TestCase): health_issues='I am a bot', emergency_contact_name='NoteKfet2020', emergency_contact_phone='+33123456789', - ml_events_registration=True, - ml_sport_registration=False, - ml_art_registration=False, )) qs = WEIRegistration.objects.filter(user_id=user.id) self.assertTrue(qs.exists()) @@ -422,9 +416,6 @@ class TestWEIRegistration(TestCase): health_issues='I am a bot', emergency_contact_name='NoteKfet2020', emergency_contact_phone='+33123456789', - ml_events_registration=True, - ml_sport_registration=False, - ml_art_registration=False, )) self.assertEqual(response.status_code, 200) self.assertTrue("This user is already registered to this WEI." in str(response.context["form"].errors)) @@ -448,9 +439,6 @@ class TestWEIRegistration(TestCase): health_issues='I am a bot', emergency_contact_name='NoteKfet2020', emergency_contact_phone='+33123456789', - ml_events_registration=True, - ml_sport_registration=False, - ml_art_registration=False, )) self.assertEqual(response.status_code, 200) self.assertTrue("This user can't be in her/his first year since he/she has already participated to a WEI." @@ -813,9 +801,6 @@ class TestWEISurveyAlgorithm(TestCase): health_issues="I am a bot", emergency_contact_name="Pikachu", emergency_contact_phone="+33123456789", - ml_events_registration=True, - ml_sport_registration=True, - ml_art_registration=True, first_year=True, ) CurrentSurvey(self.registration).save() diff --git a/apps/wei/views.py b/apps/wei/views.py index 5b16fe3a8bd1b2e37858aa9e636a5e5337fb7892..ada4c5d8a76c40d7fe411eb4dde76887a0a6c3d0 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -594,9 +594,6 @@ class WEIRegister2AView(ProtectQuerysetMixin, LoginRequiredMixin, ProtectedCreat del form.fields["caution_check"] del form.fields["first_year"] - del form.fields["ml_events_registration"] - del form.fields["ml_art_registration"] - del form.fields["ml_sport_registration"] del form.fields["information_json"] return form