From: Guillaume Pellerin Date: Wed, 3 Feb 2016 23:24:55 +0000 (+0100) Subject: fix student training X-Git-Tag: 1.1~132 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=9866cc070f07f0f23c0c67f7021d7b1154060581;p=teleforma.git fix student training --- 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