From: Guillaume Pellerin Date: Wed, 3 Feb 2016 21:50:03 +0000 (+0100) Subject: add single student training X-Git-Tag: 1.1~149 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=3007f706a90cfc18b0839df846aa05dc416444b1;p=teleforma.git add single student training --- diff --git a/teleforma/forms.py b/teleforma/forms.py index 66a253dd..7d62779b 100644 --- a/teleforma/forms.py +++ b/teleforma/forms.py @@ -15,7 +15,7 @@ class ConferenceForm(ModelForm): class UserForm(ModelForm): - captcha = CaptchaField() + captcha = CaptchaField(help_text="Merci de recopier le texte présenté") class Meta: model = User @@ -63,5 +63,5 @@ class StudentInline(InlineFormSet): model = Student can_delete = False - fields = ['level', 'iej', 'period', 'platform_only', 'trainings', 'procedure', + fields = ['level', 'iej', 'period', 'training', 'platform_only', 'procedure', 'written_speciality', 'oral_speciality', 'oral_1', 'oral_2'] diff --git a/teleforma/models/crfpa.py b/teleforma/models/crfpa.py index eb436cb8..ac7cbaf9 100644 --- a/teleforma/models/crfpa.py +++ b/teleforma/models/crfpa.py @@ -91,8 +91,15 @@ class Training(Model): verbose_name=_('magistral'), blank=True, null=True) cost = models.FloatField(_('cost'), blank=True, null=True) + available = models.BooleanField(_('available')) def __unicode__(self): + if self.name: + return self.name + else: + return self.get_code() + + def get_code(self): code = self.code if self.period: code += ' - ' + self.period.name @@ -111,6 +118,8 @@ class Student(Model): blank=True, null=True, on_delete=models.SET_NULL) trainings = models.ManyToManyField('Training', related_name='student_trainings', verbose_name=_('trainings'), blank=True, null=True) + training = models.ForeignKey('Training', related_name='student_training', verbose_name=_('training'), + blank=True, null=True) 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}) diff --git a/teleforma/templates/registration/registration_form.html b/teleforma/templates/registration/registration_form.html index 079ac4dd..8bd656e1 100644 --- a/teleforma/templates/registration/registration_form.html +++ b/teleforma/templates/registration/registration_form.html @@ -9,17 +9,11 @@
{% csrf_token %} - {% for formset in inlines %} {{ formset.management_form }} {% for form in formset %} - {% endfor %} {% endfor %}
{{ form }} -
-
{{ form }} -
-
diff --git a/teleforma/views/crfpa.py b/teleforma/views/crfpa.py index c804b6c5..9a89fe9f 100644 --- a/teleforma/views/crfpa.py +++ b/teleforma/views/crfpa.py @@ -411,13 +411,6 @@ class UserAddView(CreateWithInlinesView): user.save() return super(UserAddView, self).forms_valid(form, inlines) - #def construct_inlines(self): - #Filtra el socio de negocio del detalle por tipo=Proveedor (Aseguradora) - # inlines = super(CreateWithInlinesView, self).construct_inlines() - # student_inline = inlines[1] - # student_inline.form.base_fields['procedure'].queryset = Course.objects.filter(title__contains='civil') - # return inlines - class UserCompleteView(TemplateView):