From 4de82b088d65c40e1957ed9220939efaf07a5a22 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Mon, 7 Oct 2019 14:42:42 +0200 Subject: [PATCH] Student.mark_ep is choice-based --- stages/migrations/0023_mark_ep_to_choices.py | 28 ++++++++++++++++++++ stages/models.py | 10 +++++-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 stages/migrations/0023_mark_ep_to_choices.py diff --git a/stages/migrations/0023_mark_ep_to_choices.py b/stages/migrations/0023_mark_ep_to_choices.py new file mode 100644 index 0000000..1a2e1d5 --- /dev/null +++ b/stages/migrations/0023_mark_ep_to_choices.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2 on 2019-10-07 14:09 + +from django.db import migrations, models +from stages.models import IMPUTATION_CHOICES + + +class Migration(migrations.Migration): + + dependencies = [ + ('stages', '0022_student_entretienprof_fields'), + ] + + operations = [ + migrations.RemoveField( + model_name='student', + name='mark_ep', + ), + migrations.AddField( + model_name='student', + name='mark_ep', + field=models.CharField(blank=True, choices=[('non', 'Non acquis'), ('part', 'Partiellement acquis'), ('acq', 'Acquis')], default='', max_length=5, verbose_name='Note EP'), + ), + migrations.AlterField( + model_name='course', + name='imputation', + field=models.CharField(choices=IMPUTATION_CHOICES, max_length=12, verbose_name='Imputation'), + ), + ] diff --git a/stages/models.py b/stages/models.py index 5512c32..5f8d189 100644 --- a/stages/models.py +++ b/stages/models.py @@ -263,6 +263,12 @@ GENDER_CHOICES = ( ) class Student(models.Model): + ACQ_MARK_CHOICES = ( + ('non', 'Non acquis'), + ('part', 'Partiellement acquis'), + ('acq', 'Acquis'), + ) + ext_id = models.IntegerField(null=True, unique=True, verbose_name='ID externe') first_name = models.CharField(max_length=40, verbose_name='Prénom') last_name = models.CharField(max_length=40, verbose_name='Nom') @@ -326,7 +332,7 @@ class Student(models.Model): ) date_exam_ep = models.DateTimeField("Date exam. EP", blank=True, null=True) room_ep = models.CharField('Salle EP', max_length=15, blank=True) - mark_ep = models.DecimalField('Note EP', max_digits=3, decimal_places=2, blank=True, null=True) + mark_ep = models.CharField('Note EP', max_length=5, choices=ACQ_MARK_CHOICES, blank=True) internal_expert_ep = models.ForeignKey( Teacher, related_name='rel_internal_expert_ep', verbose_name='Expert interne EP', null=True, blank=True, on_delete=models.SET_NULL @@ -648,7 +654,7 @@ class Course(models.Model): subject = models.CharField("Sujet", max_length=100, default='') period = models.IntegerField("Nb de périodes", default=0) # Imputation comptable: compte dans lequel les frais du cours seront imputés - imputation = models.CharField("Imputation", max_length=10, choices=IMPUTATION_CHOICES) + imputation = models.CharField("Imputation", max_length=12, choices=IMPUTATION_CHOICES) class Meta: verbose_name = 'Cours'