]> git.parisson.com Git - teleforma.git/commitdiff
add new fields to register form
authorYoan Le Clanche <yoanl@pilotsystems.net>
Thu, 24 Sep 2026 13:58:11 +0000 (15:58 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Thu, 24 Sep 2026 13:58:11 +0000 (15:58 +0200)
teleforma/admin.py
teleforma/forms.py
teleforma/migrations/0015_student_training_adaptability_disability.py [new file with mode: 0644]
teleforma/models/core.py
teleforma/templates/registration/registration_form.html
teleforma/templates/registration/registration_pdf.html

index 241e9524da5a38b0179435ce7a0d3313e11bd039..4c0d637086c0ba745587096b8afc2b80606781c5 100644 (file)
@@ -187,7 +187,7 @@ else:
         inlines = [PaymentInline, OptionalFeeInline, DiscountInline, PaybackInline]
         search_fields = ['user__first_name', 'user__last_name', 'user__username', 'receipt_id']
         list_filter = ['user__is_active', 'restricted', 'is_subscribed', 'platform_only', PeriodListFilter,
-                        'fascicule', BalanceFilter ]
+                        'fascicule', 'training_adaptability', 'disability', BalanceFilter ]
         list_display = ['student_name', 'restricted', 'get_trainings', 'platform_only',
                         'total_payments', 'total_fees', 'balance', 'balance_intermediary']
         readonly_fields = [ 'balance', 'balance_intermediary' ]
index c411e778bb4bd7c88cc02454aff1e8f9dfa09d55..80ff11d4c55f4af60fe2ee918f612fdfaadaad1d 100644 (file)
@@ -241,6 +241,13 @@ else:
         courses = ModelChoiceField(label='Matières',
                                     queryset=Course.objects.filter(id__in=settings.TELEFORMA_REGISTER_COURSE_CHOICE))
 
+        training_adaptability = forms.ChoiceField(choices=TRUE_FALSE_CHOICES,
+                                                  label="Avez-vous besoin d'adaptabilité de formation ?",
+                                                  widget=forms.Select())
+        disability = forms.ChoiceField(choices=TRUE_FALSE_CHOICES,
+                                       label='Êtes-vous en situation de handicap ?',
+                                       widget=forms.Select())
+
         
         promo_code = CharField(label=_('Code promo'), max_length=100, required=False)
 
@@ -263,6 +270,7 @@ else:
             self.fields['last_name'].required = True
             self.fields['email'].required = True
             self.user_fields = ['first_name', 'last_name', 'email', 'address', 'address_detail', 'postal_code', 'city', 'country', 'telephone', 'lawyer_country', 'different_billing_address', 'billing_address', 'billing_address_detail', 'billing_postal_code', 'billing_city', 'billing_country']
+            self.adaptability_fields = ['training_adaptability', 'disability']
             self.training_fields = ['platform_only', 'period', 'training', 'courses']
 
         def clean(self):
@@ -319,6 +327,8 @@ else:
                             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()
diff --git a/teleforma/migrations/0015_student_training_adaptability_disability.py b/teleforma/migrations/0015_student_training_adaptability_disability.py
new file mode 100644 (file)
index 0000000..aed2858
--- /dev/null
@@ -0,0 +1,21 @@
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('teleforma', '0014_add_lawyer_country_and_billing_address'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='student',
+            name='training_adaptability',
+            field=models.BooleanField(blank=True, default=False, verbose_name="besoin d'adaptabilité de formation"),
+        ),
+        migrations.AddField(
+            model_name='student',
+            name='disability',
+            field=models.BooleanField(blank=True, default=False, verbose_name='situation de handicap'),
+        ),
+    ]
index 29831f48b7b105f90c431bf6aded5198e5b6876a..f80ced3b1dbda791baa4c52f8d605d0f438f5ed4 100755 (executable)
@@ -1085,6 +1085,10 @@ class StudentMixin(models.Model):
 
     fascicule = models.BooleanField(_('envoi des fascicules'), blank=True,
                                     default=False)
+    training_adaptability = models.BooleanField("besoin d'adaptabilité de formation",
+                                                blank=True, default=False)
+    disability = models.BooleanField('situation de handicap', blank=True,
+                                     default=False)
 
     payment_type = models.CharField(_('type de paiement'), choices=payment_choices,
                                     max_length=64, blank=True, null=True,
index c1eaeedf57352c8c85dd2caf02353ad6c1bfb123..f96a39ddfbaf0323c2f61fe054e341358b189a41 100644 (file)
         </div>
     </fieldset>
 
+    {% if form.adaptability_fields %}
+    <fieldset style="margin-top: 2em;">
+        <div class="column">
+            {% for fieldname in form.adaptability_fields %}
+            {% with field=form|get_item:fieldname %}
+            <div class="info_champs">
+                <label for="id_{{ field.name }}">
+                    {{ field.label }} <span class="required">*</span>
+                </label>
+                <span class="error">
+                    {{ field.errors }}
+                </span>
+                {{ field }}
+            </div>
+            {% endwith %}
+            {% endfor %}
+        </div>
+    </fieldset>
+    {% endif %}
+
     <h2><img src="{{ STATIC_URL }}teleforma/images/crfpa_formation.svg"
             onerror="this.onerror=null; this.src='{{ STATIC_URL }}teleforma/images/crfpa_formation.png'"
             alt="votre formation" title="votre formation" class="votreformation"
index 1b0b450783eea2e62cda4e3e92f2ce9336281630..3692e521b7510b5ce958f01d448b6b01992923d6 100644 (file)
                     <td class="bold">{% trans "Birthday" %} : </td>
                     <td>{{ profile.birthday }}</td>
                 </tr>
+                <tr>
+                    <td class="bold">Besoin d'adaptabilité de formation : </td>
+                    <td>{% if student.training_adaptability %}Oui{% else %}Non{% endif %}</td>
+                </tr>
+                <tr>
+                    <td class="bold">Situation de handicap : </td>
+                    <td>{% if student.disability %}Oui{% else %}Non{% endif %}</td>
+                </tr>
 
                 <tr>
                     <td class="bold">{% trans "Studying level" %} : </td>