written_speciality=data.get('written_speciality'),
oral_1=data.get('oral_1'),
promo_code=data.get('promo_code'),
- training=training,
payment_schedule=data.get('payment_schedule'),
fascicule=fascicule,
subscription_fees=subscription_fees
student = Student(user=user)
student.period, c = Period.objects.get_or_create(name=period)
student.iej, c = IEJ.objects.get_or_create(name=row[2].value)
- student.training, c = Training.objects.get_or_create(code=row[3].value,
- period=student.period)
+ c = Training.objects.get_or_create(code=row[3].value,
+ period=student.period)
student.save()
-
+ student.trainings.add(c)
+
student.procedure = self.get_first_course(row[4].value)
student.written_speciality = self.get_first_course(row[5].value)
student.oral_speciality = self.get_first_course(row[6].value)
--- /dev/null
+# Generated by Django 3.2.3 on 2022-02-04 09:47
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('teleforma', '0015_auto_20211210_1411'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='student',
+ name='training',
+ ),
+ ]
blank=True, null=True, on_delete=models.SET_NULL)
trainings = models.ManyToManyField('Training', related_name='student_trainings', verbose_name=_('trainings'),
blank=True)
- # deprecated, replaced by trainings field
- training = models.ForeignKey('Training', related_name='student_training', verbose_name=_('training'),
- blank=True, null=True, limit_choices_to={'available': True}, on_delete=models.SET_NULL)
procedure = models.ForeignKey('Course', related_name="procedure_students",
verbose_name=_('procedure'), help_text="Matière de procédure",
blank=True, null=True, limit_choices_to={'procedure': True}, on_delete=models.SET_NULL)
# some form fixes
student = user.student.all()[0]
- if student.training and not student.trainings.all():
- student.trainings.add(student.training)
- if not student.training and student.trainings.all():
- student.training = student.trainings.all()[0]
if not student.oral_1:
student.oral_1 = Course.objects.get(code='X')
if not student.oral_2:
student = user.student.all()[0]
- if not student.training and student.trainings.all():
- student.training = student.trainings.all()[0]
- training = student.training
+ training = student.trainings.all()[0]
period = training.period
student.save()
profile = user.profile.all()[0]