]> git.parisson.com Git - teleforma.git/commitdiff
Update to register form ae-docker ae-docker-dev
authorYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 13 Oct 2026 11:05:06 +0000 (13:05 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 13 Oct 2026 11:05:06 +0000 (13:05 +0200)
teleforma/forms.py
teleforma/templates/registration/registration_form.html
teleforma/templates/registration/registration_pdf.html
teleforma/views/crfpa.py

index 3c59ad460725832b426f65387d483d74cf158b50..b9ce51924c9eb2270ad1b3b3f5d2f4f154e71abb 100644 (file)
@@ -239,7 +239,8 @@ else:
         training = ModelChoiceField(label='Formation',
                                     queryset=Training.objects.filter(available=True))
         courses = ModelChoiceField(label='Matières',
-                                    queryset=Course.objects.filter(id__in=settings.TELEFORMA_REGISTER_COURSE_CHOICE))
+                                    queryset=Course.objects.filter(id__in=settings.TELEFORMA_REGISTER_COURSE_CHOICE),
+                                    required=False)
 
         training_adaptability = forms.ChoiceField(choices=TRUE_FALSE_CHOICES,
                                                   label="Avez-vous besoin d'adaptabilité de formation ?",
@@ -250,8 +251,6 @@ else:
                                        required=False,
                                        widget=forms.Select())
 
-        
-        promo_code = CharField(label=_('Code promo'), max_length=100, required=False)
 
         payment_schedule = ChoiceField(label=_(u'Échéancier de paiement'),
                                     choices=payment_schedule_choices,
@@ -327,14 +326,14 @@ else:
                 subscription_fees = training.cost
             student = Student(user=user,
                             platform_only=platform_only,
-                            promo_code=data.get('promo_code'),
                             payment_schedule=data.get('payment_schedule'),
                             training_adaptability=data.get('training_adaptability') == 'True',
                             disability=data.get('disability') == 'True',
                             subscription_fees=subscription_fees
                             )
             student.save()
-            student.courses.add(data.get('courses'))
+            if data.get('courses'):
+                student.courses.add(data.get('courses'))
             for course in Course.objects.filter(id__in=settings.TELEFORMA_REGISTER_COURSE_AUTOREGISTER):
                 student.courses.add(course)
             student.trainings.add(data.get('training'))
index bee05de4ea6c0513b37d0ee02a6f4898fd9861e7..58bbaa4bd85e8e720de0480ae50f1dd5323a6365 100644 (file)
                     href="http://crfpa.pre-barreau.com/tarifs/conditions-generales-dinscription">conditions générales
                     d'inscription</a></label>
             <br />
+            {% if form.promo_code %}
             <span class="error">
                 {{ form.promo_code.errors }}
             </span>
             <label for="id_promo_code">{{ form.promo_code.label }}</label>
             {{ form.promo_code }}
+            {% endif %}
             <span>
                 <span class="error">
                     {{ form.captcha.errors }}
index 3692e521b7510b5ce958f01d448b6b01992923d6..7f628e222a934f5d10e94ac07d34906434b3a392 100644 (file)
@@ -83,6 +83,7 @@
                     <td>{% if student.disability %}Oui{% else %}Non{% endif %}</td>
                 </tr>
 
+                {% if not is_ae %}
                 <tr>
                     <td class="bold">{% trans "Studying level" %} : </td>
                     <td>{{ student.level }}</td>
@@ -91,6 +92,7 @@
                     <td class="bold">{% trans "IEJ" %} : </td>
                     <td>{{ student.iej.name }}</td>
                 </tr>
+                {% endif %}
                 <tr>
                     <td class="bold">{% trans "Training" %} : </td>
                     <td>{{ student.training.name }}</td>
                     <td class="bold">{% trans "Registration date" %} : </td>
                     <td>{{ student.date_registered}}</td>
                 </tr>
+                {% if not is_ae %}
                 <tr>
                     <td class="bold">{% trans "PROMO code" %} : </td>
                     <td>{{ student.promo_code}}</td>
                 </tr>
+                {% endif %}
 
             </table>
 
index 19fd6dc192c4018543046a490b03b6b28437746e..ba21bbd0915c45815d36dc676c74375180e6289f 100644 (file)
@@ -35,6 +35,7 @@
 import datetime
 
 import xlrd
+from django.conf import settings
 from django.contrib.auth import get_backends, login
 from django.contrib.auth.decorators import login_required, permission_required
 from django.contrib.auth.models import User
@@ -623,6 +624,7 @@ class RegistrationPDFView(PDFTemplateResponseMixin, TemplateView):
         profile.save()
 
         context['student'] = student
+        context['is_ae'] = settings.TELEFORMA_E_LEARNING_TYPE == 'AE'
         return context
 
 class RegistrationPDFViewDownload(RegistrationPDFView):