From 9866cc070f07f0f23c0c67f7021d7b1154060581 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 4 Feb 2016 00:24:55 +0100 Subject: [PATCH] fix student training --- teleforma/views/crfpa.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/teleforma/views/crfpa.py b/teleforma/views/crfpa.py index 0599ab95..5a2cdde1 100644 --- a/teleforma/views/crfpa.py +++ b/teleforma/views/crfpa.py @@ -434,9 +434,10 @@ class RegistrationPDFView(PDFTemplateResponseMixin, DetailView): # user = User.objects.get(pk=kwargs['pk']) user = self.get_object() student = user.student.all()[0] - if student.training and not student.trainings: + if student.training and not student.trainings.all(): student.trainings.add(student.training) - student.save() + if not student.training and student.trainings.all(): + student.training = student.trainings.all()[0] context['student'] = student return context -- 2.39.5