diff --git a/inscription/forms.py b/inscription/forms.py index 29bb25d..0d37151 100644 --- a/inscription/forms.py +++ b/inscription/forms.py @@ -1,6 +1,6 @@ from django import forms from django.utils.translation import gettext_lazy as _ -from crispy_forms.bootstrap import FormActions, InlineField +from crispy_forms.bootstrap import FormActions, InlineField, InlineCheckboxes from crispy_forms.helper import FormHelper from crispy_forms.layout import Div, Fieldset, Layout, Submit from .models import BaseEleve @@ -51,7 +51,6 @@ class InscriptionForm1(forms.ModelForm): name = 'Identité' # mail de confirmation confirmation_email = forms.EmailField(label="Confirmation de l'email", required=False) - def __init__(self, *args, **kwargs): """ Surcharge de l'initialisation du formulaire @@ -243,6 +242,7 @@ def __init__(self, *args, **kwargs): self.helper.layout = Layout( # Liste des champs à afficher dont les champs supplémentaires 'comments', + InlineCheckboxes('dys'), 'captcha', ) @@ -250,5 +250,5 @@ class Meta: # Définis le modèle utilisé et des données à enregistrer model = BaseEleve fields = [ - 'comments', + 'comments', 'dys', ] diff --git a/inscription/models.py b/inscription/models.py index 57657af..c3ac45f 100644 --- a/inscription/models.py +++ b/inscription/models.py @@ -1,5 +1,6 @@ from django.db import models from address.models import AddressField +from multiselectfield import MultiSelectField from phonenumber_field.modelfields import PhoneNumberField from .utils import nom_photo, create_hash @@ -69,6 +70,7 @@ def __iter__(self): ('elle', 'elle'), ('iel', 'iel') ) + date_naissance = models.DateField(verbose_name="Date de naissance") commune_naissance = models.ForeignKey(Commune, on_delete=models.CASCADE, verbose_name="Commune de naissance", blank=True, null=True) @@ -121,3 +123,11 @@ def __iter__(self): sociopro_resp2 = models.ForeignKey(Sociopro, related_name='resp2', on_delete=models.CASCADE, verbose_name="Profession", blank=True, null=True) + DYS = ( + ('DL', 'Dyslexie'), + ('DC', 'Dyscalculie'), + ('DP', 'Dyspraxie'), + ('DG', 'Dysgraphie'), + ('DO', 'Dysorthographie') + ) + dys = MultiSelectField(choices=DYS,verbose_name='Troubles cognitifs', blank=True, null=True) \ No newline at end of file diff --git a/migrations/inscription/0005_baseeleve_dys_baseeleve_ville_natale_and_more.py b/migrations/inscription/0005_baseeleve_dys_baseeleve_ville_natale_and_more.py new file mode 100644 index 0000000..ac7bdf6 --- /dev/null +++ b/migrations/inscription/0005_baseeleve_dys_baseeleve_ville_natale_and_more.py @@ -0,0 +1,35 @@ +# Generated by Django 4.0 on 2022-01-24 20:10 + +from django.db import migrations, models +import django.db.models.deletion +import multiselectfield.db.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('inscription', '0004_baseeleve_nationalite'), + ] + + operations = [ + migrations.AddField( + model_name='baseeleve', + name='dys', + field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('DL', 'Dyslexie'), ('DC', 'Dyscalculie'), ('DP', 'Dyspraxie'), ('DG', 'Dysgraphie'), ('DO', 'Dysorthographie')], max_length=14, null=True, verbose_name='Troubles cognitifs'), + ), + migrations.AddField( + model_name='baseeleve', + name='ville_natale', + field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Ville natale'), + ), + migrations.AlterField( + model_name='baseeleve', + name='commune_naissance', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='inscription.commune', verbose_name='Commune de naissance'), + ), + migrations.AlterField( + model_name='baseeleve', + name='departement_naissance', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='inscription.departement', verbose_name='Département de naissance'), + ), + ]