From 5e77ca53a5d2879b92fbb1609fe9d01c207c9c9d Mon Sep 17 00:00:00 2001 From: Arthur ZHU Date: Fri, 25 Feb 2022 09:45:14 +0100 Subject: [PATCH] corrections --- app/entreprises/app_relations_entreprises.py | 33 ++++++++++--------- app/entreprises/forms.py | 8 +++-- app/templates/entreprises/contacts.html | 2 +- app/templates/entreprises/entreprises.html | 2 +- .../entreprises/entreprises_validation.html | 2 +- .../form_modification_entreprise.html | 2 +- app/templates/entreprises/offres_recues.html | 2 +- 7 files changed, 28 insertions(+), 23 deletions(-) diff --git a/app/entreprises/app_relations_entreprises.py b/app/entreprises/app_relations_entreprises.py index 421f0882..af06f6e1 100644 --- a/app/entreprises/app_relations_entreprises.py +++ b/app/entreprises/app_relations_entreprises.py @@ -172,21 +172,22 @@ def verif_entreprise_data(entreprise_data): """ Verifie les données d'une ligne Excel (entreprise) """ - for data in entreprise_data: # champs obligatoires + for data in entreprise_data[1:]: # champs obligatoires if data == "": return False - siret = entreprise_data[0].strip() # vérification sur le siret - if re.match("^\d{14}$", siret) is None: - return False - try: - req = requests.get( - f"https://entreprise.data.gouv.fr/api/sirene/v1/siret/{siret}" - ) - except requests.ConnectionError: - print("no internet") - if req.status_code != 200: - return False - entreprise = Entreprise.query.filter_by(siret=siret).first() - if entreprise is not None: - return False - return True + if EntreprisePreferences.get_check_siret(): + siret = entreprise_data[0].strip() # vérification sur le siret + if re.match("^\d{14}$", siret) is None: + return False + try: + req = requests.get( + f"https://entreprise.data.gouv.fr/api/sirene/v1/siret/{siret}" + ) + except requests.ConnectionError: + print("no internet") + if req.status_code != 200: + return False + entreprise = Entreprise.query.filter_by(siret=siret).first() + if entreprise is not None: + return False + return True diff --git a/app/entreprises/forms.py b/app/entreprises/forms.py index 5b1b175f..e5e334c3 100644 --- a/app/entreprises/forms.py +++ b/app/entreprises/forms.py @@ -145,7 +145,9 @@ class OffreCreationForm(FlaskForm): choices=[("Stage"), ("Alternance")], validators=[DataRequired(message=CHAMP_REQUIS)], ) - missions = _build_string_field("Missions") + missions = TextAreaField( + "Missions", validators=[DataRequired(message=CHAMP_REQUIS)] + ) duree = _build_string_field("Durée") depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int) expiration_date = DateField( @@ -171,7 +173,9 @@ class OffreModificationForm(FlaskForm): choices=[("Stage"), ("Alternance")], validators=[DataRequired(message=CHAMP_REQUIS)], ) - missions = _build_string_field("Missions") + missions = TextAreaField( + "Missions", validators=[DataRequired(message=CHAMP_REQUIS)] + ) duree = _build_string_field("Durée") depts = MultiCheckboxField("Départements", validators=[Optional()], coerce=int) expiration_date = DateField( diff --git a/app/templates/entreprises/contacts.html b/app/templates/entreprises/contacts.html index 7830f83a..0437c2bc 100644 --- a/app/templates/entreprises/contacts.html +++ b/app/templates/entreprises/contacts.html @@ -31,7 +31,7 @@ {% endif %} -
+

Liste des contacts

diff --git a/app/templates/entreprises/entreprises.html b/app/templates/entreprises/entreprises.html index 8e2768c6..b48668e0 100644 --- a/app/templates/entreprises/entreprises.html +++ b/app/templates/entreprises/entreprises.html @@ -34,7 +34,7 @@ {% endif %} -
+

Liste des entreprises

diff --git a/app/templates/entreprises/entreprises_validation.html b/app/templates/entreprises/entreprises_validation.html index a7fbf0c9..d37e2494 100644 --- a/app/templates/entreprises/entreprises_validation.html +++ b/app/templates/entreprises/entreprises_validation.html @@ -22,7 +22,7 @@ {% endif %} -
+

Liste des entreprises à valider

diff --git a/app/templates/entreprises/form_modification_entreprise.html b/app/templates/entreprises/form_modification_entreprise.html index c77cc12f..47ce42e6 100644 --- a/app/templates/entreprises/form_modification_entreprise.html +++ b/app/templates/entreprises/form_modification_entreprise.html @@ -15,7 +15,7 @@
- Informations de l'API Sirene + Informations de la base SIRENE
diff --git a/app/templates/entreprises/offres_recues.html b/app/templates/entreprises/offres_recues.html index 2d3c9698..a8814739 100644 --- a/app/templates/entreprises/offres_recues.html +++ b/app/templates/entreprises/offres_recues.html @@ -23,7 +23,7 @@ {% endfor %}
- supprimer + supprimer
{% endfor %}