mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-30 04:13:01 +00:00
Move the mailing list registration to the Profile model, see #50
This commit is contained in:
parent
1e4cbf60c5
commit
c50fdd6689
@ -92,6 +92,28 @@ class Profile(models.Model):
|
|||||||
default=False,
|
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(
|
report_frequency = models.PositiveSmallIntegerField(
|
||||||
verbose_name=_("report frequency (in days)"),
|
verbose_name=_("report frequency (in days)"),
|
||||||
default=0,
|
default=0,
|
||||||
|
@ -5,6 +5,7 @@ from datetime import date
|
|||||||
|
|
||||||
from django.core.management import BaseCommand
|
from django.core.management import BaseCommand
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from member.models import Membership, Club
|
from member.models import Membership, Club
|
||||||
from wei.models import WEIClub
|
from wei.models import WEIClub
|
||||||
|
|
||||||
@ -21,6 +22,13 @@ class Command(BaseCommand):
|
|||||||
help='Select the year of the concerned WEI. Default: last year')
|
help='Select the year of the concerned WEI. Default: last year')
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
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":
|
if options["type"] == "members":
|
||||||
for membership in Membership.objects.filter(
|
for membership in Membership.objects.filter(
|
||||||
club__name="BDE",
|
club__name="BDE",
|
||||||
|
@ -229,21 +229,6 @@ class WEIRegistration(models.Model):
|
|||||||
verbose_name=_("emergency contact phone"),
|
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(
|
first_year = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
verbose_name=_("first year"),
|
verbose_name=_("first year"),
|
||||||
|
@ -77,15 +77,6 @@
|
|||||||
<dt class="col-xl-6">{% trans 'emergency contact phone'|capfirst %}</dt>
|
<dt class="col-xl-6">{% trans 'emergency contact phone'|capfirst %}</dt>
|
||||||
<dd class="col-xl-6">{{ registration.emergency_contact_phone }}</dd>
|
<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>
|
<dt class="col-xl-6">{% trans 'Payment from Société générale' %}</dt>
|
||||||
<dd class="col-xl-6">{{ registration.soge_credit|yesno }}</dd>
|
<dd class="col-xl-6">{{ registration.soge_credit|yesno }}</dd>
|
||||||
|
|
||||||
|
@ -99,9 +99,6 @@ class TestWEIRegistration(TestCase):
|
|||||||
health_issues="I am a bot",
|
health_issues="I am a bot",
|
||||||
emergency_contact_name="Pikachu",
|
emergency_contact_name="Pikachu",
|
||||||
emergency_contact_phone="+33123456789",
|
emergency_contact_phone="+33123456789",
|
||||||
ml_events_registration=True,
|
|
||||||
ml_sport_registration=True,
|
|
||||||
ml_art_registration=True,
|
|
||||||
first_year=False,
|
first_year=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -387,9 +384,6 @@ class TestWEIRegistration(TestCase):
|
|||||||
health_issues='I am a bot',
|
health_issues='I am a bot',
|
||||||
emergency_contact_name='NoteKfet2020',
|
emergency_contact_name='NoteKfet2020',
|
||||||
emergency_contact_phone='+33123456789',
|
emergency_contact_phone='+33123456789',
|
||||||
ml_events_registration=True,
|
|
||||||
ml_sport_registration=False,
|
|
||||||
ml_art_registration=False,
|
|
||||||
))
|
))
|
||||||
qs = WEIRegistration.objects.filter(user_id=user.id)
|
qs = WEIRegistration.objects.filter(user_id=user.id)
|
||||||
self.assertTrue(qs.exists())
|
self.assertTrue(qs.exists())
|
||||||
@ -422,9 +416,6 @@ class TestWEIRegistration(TestCase):
|
|||||||
health_issues='I am a bot',
|
health_issues='I am a bot',
|
||||||
emergency_contact_name='NoteKfet2020',
|
emergency_contact_name='NoteKfet2020',
|
||||||
emergency_contact_phone='+33123456789',
|
emergency_contact_phone='+33123456789',
|
||||||
ml_events_registration=True,
|
|
||||||
ml_sport_registration=False,
|
|
||||||
ml_art_registration=False,
|
|
||||||
))
|
))
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertTrue("This user is already registered to this WEI." in str(response.context["form"].errors))
|
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',
|
health_issues='I am a bot',
|
||||||
emergency_contact_name='NoteKfet2020',
|
emergency_contact_name='NoteKfet2020',
|
||||||
emergency_contact_phone='+33123456789',
|
emergency_contact_phone='+33123456789',
|
||||||
ml_events_registration=True,
|
|
||||||
ml_sport_registration=False,
|
|
||||||
ml_art_registration=False,
|
|
||||||
))
|
))
|
||||||
self.assertEqual(response.status_code, 200)
|
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."
|
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",
|
health_issues="I am a bot",
|
||||||
emergency_contact_name="Pikachu",
|
emergency_contact_name="Pikachu",
|
||||||
emergency_contact_phone="+33123456789",
|
emergency_contact_phone="+33123456789",
|
||||||
ml_events_registration=True,
|
|
||||||
ml_sport_registration=True,
|
|
||||||
ml_art_registration=True,
|
|
||||||
first_year=True,
|
first_year=True,
|
||||||
)
|
)
|
||||||
CurrentSurvey(self.registration).save()
|
CurrentSurvey(self.registration).save()
|
||||||
|
@ -594,9 +594,6 @@ class WEIRegister2AView(ProtectQuerysetMixin, LoginRequiredMixin, ProtectedCreat
|
|||||||
|
|
||||||
del form.fields["caution_check"]
|
del form.fields["caution_check"]
|
||||||
del form.fields["first_year"]
|
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"]
|
del form.fields["information_json"]
|
||||||
|
|
||||||
return form
|
return form
|
||||||
|
Loading…
Reference in New Issue
Block a user