]> git.parisson.com Git - teleforma.git/commitdiff
add single student training
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 3 Feb 2016 21:50:03 +0000 (22:50 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 3 Feb 2016 21:50:03 +0000 (22:50 +0100)
teleforma/forms.py
teleforma/models/crfpa.py
teleforma/templates/registration/registration_form.html
teleforma/views/crfpa.py

index 66a253dd8fb986ab5afbd80efba62c3bf66adced..7d62779bfadfe81b74e3b9fac51890e02bbf36ba 100644 (file)
@@ -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']
index eb436cb8936c54eef1064ef4854340dc7d9f741b..ac7cbaf9ec4c4410c4cf65008c2560ddcf0e7ebc 100644 (file)
@@ -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})
index 079ac4dd08c90f6fa9f7f573ae2e3b0c00d5b524..8bd656e1e61309875edca27da19b7738627ba2e1 100644 (file)
@@ -9,17 +9,11 @@
 <center>
     <form class="register" id="_registerForm" method="post" action="" enctype="multipart/form-data" data-ajax="false">{% csrf_token %}
     <table>
-        <tr><td>
         {{ form }}
-        <hr/>
-        </td></tr>
         {% for formset in inlines %}
           {{ formset.management_form }}
           {% for form in formset %}
-          <tr><td>
            {{ form }}
-           <hr/>
-          </td></tr>
           {% endfor %}
         {% endfor %}
     </table>
index c804b6c5d47d987615c12784650be63b1d16dc1f..9a89fe9f699ab597f367afcda26fe109a1c85ff5 100644 (file)
@@ -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):