Add validation date, rename confirmation_date

This commit is contained in:
Claude Paroz 2018-02-02 09:36:05 +01:00
parent 26ffd6d025
commit 5a2a5d769f
5 changed files with 44 additions and 12 deletions

View file

@ -117,7 +117,7 @@ class CandidateAdmin(admin.ModelAdmin):
form = CandidateForm
list_display = ('last_name', 'first_name', 'section', 'confirm_mail', 'convocation')
list_filter = ('section', 'option')
readonly_fields = ('total_result_points', 'total_result_mark', 'date_confirmation_mail')
readonly_fields = ('total_result_points', 'total_result_mark', 'confirmation_date')
actions = [export_candidates, send_confirmation_mail, print_summary]
fieldsets = (
(None, {
@ -127,7 +127,7 @@ class CandidateAdmin(admin.ModelAdmin):
('birth_date', 'avs', 'handicap', 'has_photo'),
('section', 'option'),
('corporation', 'instructor'),
('deposite_date', 'date_confirmation_mail', 'canceled_file'),
('deposite_date', 'confirmation_date', 'canceled_file'),
'comment',
),
}),
@ -150,7 +150,7 @@ class CandidateAdmin(admin.ModelAdmin):
)
def confirm_mail(self, obj):
return obj.date_confirmation_mail is not None
return obj.confirmation_date is not None
confirm_mail.boolean = True
def convocation(self, obj):

View file

@ -27,12 +27,12 @@ class Migration(migrations.Migration):
('email', models.EmailField(blank=True, max_length=254, verbose_name='Courriel')),
('avs', models.CharField(blank=True, max_length=15, verbose_name='No AVS')),
('handicap', models.BooleanField(default=False)),
('section', models.CharField(choices=[('ASA', 'Aide en soin et accompagnement AFP'), ('ASE', 'Assist. socio-éducatif-ve CFC'), ('ASSC', 'Assist. en soin et santé communautaire CFC'), ('EDE', "Educ. de l'enfance, dipl. ES"), ('EDS', 'Educ. social-e, dipl. ES')], max_length=10, verbose_name='Filière')),
('section', models.CharField(choices=[('ASA', 'Aide en soin et accompagnement AFP'), ('ASE', 'Assist. socio-éducatif-ve CFC'), ('ASSC', 'Assist. en soin et santé communautaire CFC'), ('EDE', "Education de l'enfance, dipl. ES"), ('EDS', 'Education sociale, dipl. ES')], max_length=10, verbose_name='Filière')),
('option', models.CharField(blank=True, choices=[('GEN', 'Généraliste'), ('ENF', 'Enfance'), ('PAG', 'Personnes âgées'), ('HAN', 'Handicap'), ('PE-5400h', 'Parcours Emploi 5400h.'), ('PE-3600h', 'Parcours Emploi 3600h.'), ('PS', 'Parcours stage')], max_length=20, verbose_name='Option')),
('exemption_ecg', models.BooleanField(default=False)),
('validation_sfpo', models.DateField(blank=True, null=True, verbose_name='Confirmation SFPO')),
('integration_second_year', models.BooleanField(default=False, verbose_name='Intégration')),
('date_confirmation_mail', models.DateField(blank=True, null=True, verbose_name='Mail de confirmation')),
('date_confirmation_mail', models.DateField(blank=True, null=True, verbose_name='Envoi mail de confirmation')),
('canceled_file', models.BooleanField(default=False, verbose_name='Dossier retiré')),
('has_photo', models.BooleanField(default=False, verbose_name='Photo passeport')),
('registration_form', models.BooleanField(default=False, verbose_name="Formulaire d'inscription")),

View file

@ -0,0 +1,31 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('candidats', '0006_residence_permits_nullable'),
]
operations = [
migrations.AddField(
model_name='candidate',
name='validation_date',
field=models.DateTimeField(blank=True, null=True, verbose_name='Envoi mail de validation'),
),
migrations.AlterField(
model_name='candidate',
name='convocation_date',
field=models.DateTimeField(blank=True, null=True, verbose_name='Envoi mail de confirmation'),
),
migrations.RenameField(
model_name='candidate',
old_name='date_confirmation_mail',
new_name='confirmation_date',
),
migrations.AlterField(
model_name='candidate',
name='confirmation_date',
field=models.DateTimeField(blank=True, null=True, verbose_name='Envoi mail de confirmation'),
),
]

View file

@ -13,8 +13,8 @@ SECTION_CHOICES = (
('ASA', 'Aide en soin et accompagnement AFP'),
('ASE', 'Assist. socio-éducatif-ve CFC'),
('ASSC', 'Assist. en soin et santé communautaire CFC'),
('EDE', 'Educ. de l\'enfance, dipl. ES'),
('EDS', 'Educ. social-e, dipl. ES'),
('EDE', "Education de l'enfance, dipl. ES"),
('EDS', 'Education sociale, dipl. ES'),
)
OPTION_CHOICES = (
@ -76,7 +76,7 @@ class Candidate(models.Model):
exemption_ecg = models.BooleanField(default=False)
validation_sfpo = models.DateField('Confirmation SFPO', blank=True, null=True)
integration_second_year = models.BooleanField('Intégration', default=False)
date_confirmation_mail = models.DateField('Mail de confirmation', blank=True, null=True)
confirmation_date = models.DateTimeField('Envoi mail de confirmation', blank=True, null=True)
canceled_file = models.BooleanField('Dossier retiré', default=False)
has_photo = models.BooleanField(default=False, verbose_name='Photo passeport')
@ -114,7 +114,8 @@ class Candidate(models.Model):
diploma_detail = models.CharField('Détail titre', max_length=30, blank=True, default='')
diploma_status = models.PositiveSmallIntegerField("Statut titre", choices=DIPLOMA_STATUS_CHOICES, default=0)
activity_rate = models.CharField("Taux d'activité", max_length=50, blank=True, default='')
convocation_date = models.DateTimeField(null=True, blank=True, default=None)
validation_date = models.DateTimeField('Envoi mail de validation', null=True, blank=True)
convocation_date = models.DateTimeField('Envoi mail de confirmation', null=True, blank=True)
aes_accords = models.PositiveSmallIntegerField("Accord AES", choices=AES_ACCORDS_CHOICES, default=0)
residence_permits = models.PositiveSmallIntegerField(

View file

@ -92,7 +92,7 @@ class CandidateTests(TestCase):
# A mail should NOT be sent for those first 2
Candidate(
first_name='Jill', last_name='Simth', gender='F', section=ede,
deposite_date=date.today(), date_confirmation_mail=date.today()),
deposite_date=date.today(), confirmation_date=date.today()),
Candidate(first_name='Hervé', last_name='Bern', gender='M', section=ede,
deposite_date=date.today(), canceled_file=True),
# Good
@ -142,7 +142,7 @@ me@example.org
""".format()
)
# One was already set, 2 new.
self.assertEqual(Candidate.objects.filter(date_confirmation_mail__isnull=False).count(), 3)
self.assertEqual(Candidate.objects.filter(confirmation_date__isnull=False).count(), 3)
def test_send_confirmation_error(self):
ede = Section.objects.create(name='EDE')
@ -160,7 +160,7 @@ me@example.org
}, follow=True)
self.assertContains(response, "Échec denvoi pour le candidat Dupond Henri (Error sending mail)")
henri.refresh_from_db()
self.assertIsNone(henri.date_confirmation_mail)
self.assertIsNone(henri.confirmation_date)
def test_convocation_ede(self):
ede = Section.objects.create(name='EDE')