From b46c377919df2dbb8ad01c0d32c128cdec663925 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Wed, 14 Feb 2018 18:30:10 +0100 Subject: [PATCH] Add candidate.examination_teacher --- candidats/admin.py | 3 ++- .../0008_add_examination_teacher.py | 21 +++++++++++++++++++ candidats/models.py | 7 ++++++- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 candidats/migrations/0008_add_examination_teacher.py diff --git a/candidats/admin.py b/candidats/admin.py index 04d0b7c..bae89f0 100644 --- a/candidats/admin.py +++ b/candidats/admin.py @@ -72,7 +72,8 @@ class CandidateAdmin(admin.ModelAdmin): 'marks_certificate', 'residence_permits', 'aes_accords'), ('certif_of_800_childhood', 'certif_of_800_general', 'work_certificate'), ('promise', 'contract', 'activity_rate'), - ('interview',), + ('inscr_other_school',), + ('interview', 'examination_teacher'), ('examination_result', 'interview_result', 'file_result', 'total_result_points', 'total_result_mark'), ('confirmation_date', 'validation_date', 'convocation_date'), diff --git a/candidats/migrations/0008_add_examination_teacher.py b/candidats/migrations/0008_add_examination_teacher.py new file mode 100644 index 0000000..c4be9e2 --- /dev/null +++ b/candidats/migrations/0008_add_examination_teacher.py @@ -0,0 +1,21 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stages', '__first__'), + ('candidats', '0007_candidate_datetime_fields'), + ] + + operations = [ + migrations.AlterModelOptions( + name='candidate', + options={'ordering': ('last_name',), 'verbose_name': 'Candidat'}, + ), + migrations.AddField( + model_name='candidate', + name='examination_teacher', + field=models.ForeignKey(blank=True, limit_choices_to=models.Q(('abrev', 'MME'), ('abrev', 'CLG'), _connector='OR'), null=True, on_delete=models.deletion.SET_NULL, to='stages.Teacher', verbose_name='Correct. dossier'), + ), + ] diff --git a/candidats/models.py b/candidats/models.py index 704c83d..762e369 100644 --- a/candidats/models.py +++ b/candidats/models.py @@ -1,4 +1,5 @@ from django.db import models +from django.db.models import Q from django.utils.dateformat import format as django_format from stages.models import Corporation, CorpContact, Teacher @@ -101,6 +102,10 @@ class Candidate(models.Model): marks_certificate = models.BooleanField("Bull. de notes", default=False) deposite_date = models.DateField('Date dépôt dossier') + examination_teacher = models.ForeignKey( + Teacher, null=True, blank=True, on_delete=models.SET_NULL, + limit_choices_to=Q(abrev='MME') | Q(abrev='CLG'), verbose_name='Correct. dossier' + ) examination_result = models.PositiveSmallIntegerField('Points examen', blank=True, null=True) interview_result = models.PositiveSmallIntegerField('Points entretien prof.', blank=True, null=True) file_result = models.PositiveSmallIntegerField('Points dossier', blank=True, null=True) @@ -177,7 +182,7 @@ class Interview(models.Model): ordering = ('date',) def __str__(self): - return '{0} : {1}/{2} - ({3}) -salle:{4}-{5}'.format( + return '{0} : {1} (Ent.) / {2} (Dos.) - ({3}) -salle:{4}-{5}'.format( self.date_formatted, self.teacher_int.abrev if self.teacher_int else '?', self.teacher_file.abrev if self.teacher_file else '?',