Added convoc/confirm dates for student examination
This commit is contained in:
parent
8da961fdc5
commit
d3d8d1dfc5
6 changed files with 44 additions and 7 deletions
|
|
@ -254,7 +254,6 @@ Sans nouvelles de votre part 5 jours ouvrables avant la date du premier examen,
|
|||
|
||||
# Now send the message
|
||||
response = self.client.post(reverse('candidate-convocation', args=[henri.pk]), data={
|
||||
'id_candidate': str(henri.pk),
|
||||
'cci': 'me@example.org',
|
||||
'to': henri.email,
|
||||
'subject': "Procédure de qualification",
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class StudentAdmin(admin.ModelAdmin):
|
|||
list_filter = (('archived', ArchivedListFilter), ('klass', KlassRelatedListFilter))
|
||||
search_fields = ('last_name', 'first_name', 'pcode', 'city', 'klass__name')
|
||||
autocomplete_fields = ('corporation', 'instructor', 'supervisor', 'mentor', 'expert')
|
||||
readonly_fields = ('report_sem1_sent', 'report_sem2_sent', 'examination_actions')
|
||||
readonly_fields = ('report_sem1_sent', 'report_sem2_sent', 'examination_actions', 'date_soutenance_mailed')
|
||||
fieldsets = (
|
||||
(None, {
|
||||
'fields': (('last_name', 'first_name', 'ext_id'), ('street', 'pcode', 'city', 'district'),
|
||||
|
|
@ -133,6 +133,7 @@ class StudentAdmin(admin.ModelAdmin):
|
|||
('training_referent', 'referent', 'mentor'),
|
||||
('internal_expert', 'expert'),
|
||||
('session', 'date_exam', 'room', 'mark'),
|
||||
('date_soutenance_mailed', 'date_confirm_received'),
|
||||
('examination_actions',)
|
||||
)
|
||||
}),
|
||||
|
|
|
|||
21
stages/migrations/0012_added_date_fields_for_student.py
Normal file
21
stages/migrations/0012_added_date_fields_for_student.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stages', '0011_complement_corpcontact_fields'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='student',
|
||||
name='date_confirm_received',
|
||||
field=models.DateTimeField(blank=True, null=True, verbose_name='Récept. confirm'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='student',
|
||||
name='date_soutenance_mailed',
|
||||
field=models.DateTimeField(blank=True, null=True, verbose_name='Convoc. env.'),
|
||||
),
|
||||
]
|
||||
|
|
@ -260,8 +260,9 @@ class Student(models.Model):
|
|||
last_appointment = models.DateField(blank=True, null=True)
|
||||
room = models.CharField('Salle', max_length=15, blank=True)
|
||||
mark = models.DecimalField('Note', max_digits=3, decimal_places=2, blank=True, null=True)
|
||||
date_soutenance_mailed = models.DateTimeField("Convoc. env.", blank=True, null=True)
|
||||
date_confirm_received = models.DateTimeField("Récept. confirm", blank=True, null=True)
|
||||
# ============== Fields for examination ======================
|
||||
|
||||
support_tabimport = True
|
||||
|
||||
class Meta:
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ class StagesTest(TestCase):
|
|||
)
|
||||
Student.objects.bulk_create([
|
||||
Student(first_name="Albin", last_name="Dupond", birth_date="1994-05-12",
|
||||
pcode="2300", city="La Chaux-de-Fonds", klass=klass1),
|
||||
pcode="2300", city="La Chaux-de-Fonds", email="albin@example.org",
|
||||
klass=klass1),
|
||||
Student(first_name="Justine", last_name="Varrin", birth_date="1994-07-12",
|
||||
pcode="2000", city="Neuchâtel", klass=klass1),
|
||||
Student(first_name="Elvire", last_name="Hickx", birth_date="1994-05-20",
|
||||
|
|
@ -191,6 +192,17 @@ me@example.org
|
|||
tél. 032 886 33 00
|
||||
"""
|
||||
self.assertEqual(response.context['form'].initial['message'], expected_message)
|
||||
# Now send the message
|
||||
response = self.client.post(url, data={
|
||||
'cci': 'me@example.org',
|
||||
'to': st.email,
|
||||
'subject': "Convocation",
|
||||
'message': "Monsieur Albin, ...",
|
||||
'sender': 'me@example.org',
|
||||
})
|
||||
self.assertEqual(len(mail.outbox), 1)
|
||||
st.refresh_from_db()
|
||||
self.assertIsNotNone(st.date_soutenance_mailed)
|
||||
|
||||
def test_print_letter_ede_expert(self):
|
||||
st = Student.objects.get(first_name="Albin")
|
||||
|
|
|
|||
|
|
@ -668,9 +668,8 @@ class EmailConfirmationView(EmailConfirmationBaseView):
|
|||
class StudentConvocationExaminationView(EmailConfirmationView):
|
||||
success_message = "Le message de convocation a été envoyé pour l’étudiant {person}"
|
||||
title = "Convocation à la soutenance du travail de diplôme"
|
||||
candidate_date_field = 'convocation_date'
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
self.student = Student.objects.get(pk=self.kwargs['pk'])
|
||||
error = ''
|
||||
if not self.student.is_examination_valid:
|
||||
|
|
@ -682,7 +681,7 @@ class StudentConvocationExaminationView(EmailConfirmationView):
|
|||
if error:
|
||||
messages.error(request, error)
|
||||
return redirect(reverse("admin:stages_student_change", args=(self.student.pk,)))
|
||||
return super().get(request, *args, **kwargs)
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_initial(self):
|
||||
initial = super().get_initial()
|
||||
|
|
@ -730,6 +729,10 @@ class StudentConvocationExaminationView(EmailConfirmationView):
|
|||
})
|
||||
return initial
|
||||
|
||||
def on_success(self, student):
|
||||
student.date_soutenance_mailed = timezone.now()
|
||||
student.save()
|
||||
|
||||
|
||||
EXPORT_FIELDS = [
|
||||
# Student fields
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue