corrections

This commit is contained in:
Arthur ZHU 2022-02-25 09:45:14 +01:00
parent c86d780585
commit 5e77ca53a5
7 changed files with 28 additions and 23 deletions

View File

@ -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

View File

@ -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(

View File

@ -31,7 +31,7 @@
{% endif %}
</div>
<div class="container">
<div class="container" style="margin-bottom: 10px;">
<h1>Liste des contacts</h1>
<table id="table-contacts">
<thead>

View File

@ -34,7 +34,7 @@
{% endif %}
</div>
<div class="container">
<div class="container" style="margin-bottom: 10px;">
<h1>Liste des entreprises</h1>
<table id="table-entreprises">
<thead>

View File

@ -22,7 +22,7 @@
</div>
{% endif %}
<div class="container">
<div class="container" style="margin-bottom: 10px;">
<h1>Liste des entreprises à valider</h1>
<table id="table-entreprises-validation">
<thead>

View File

@ -15,7 +15,7 @@
</div>
<div id="sirene-data" class="col-md-5">
<b>Informations de l'API Sirene</b>
<b>Informations de la base SIRENE</b>
<div id="nom_entreprise_base"></div>
<div id="adresse_base"></div>
<div id="codepostal_base"></div>

View File

@ -23,7 +23,7 @@
{% endfor %}
</div>
<div>
<a href="{{ url_for('entreprises.delete_offre_recue', id=offre[0].id) }}" style="margin-left: 5px;"><img title="Supprimer fichier" alt="supprimer" width="16" height="16" border="0" src="/ScoDoc/static/icons/delete_small_img.png" /></a>
<a href="{{ url_for('entreprises.delete_offre_recue', id=offre[0].id) }}" style="margin-left: 5px;"><img title="Supprimer" alt="supprimer" width="16" height="16" border="0" src="/ScoDoc/static/icons/delete_small_img.png" /></a>
</div>
</div>
{% endfor %}