fix format of file

This commit is contained in:
Cayo Puigdefabregas 2022-07-05 18:36:27 +02:00
parent e8b957c697
commit 3af2645706
1 changed files with 7 additions and 1 deletions

View File

@ -1458,7 +1458,11 @@ class UploadPlaceholderForm(FlaskForm):
for k, v in x.items():
data[head[i]][k] = v[i]
else:
data = pd.read_excel(_file).to_dict()
try:
data = pd.read_excel(_file).to_dict()
except ValueError:
self.placeholder_file.errors = ["File don't have a correct format"]
return False
return data
@ -1472,6 +1476,8 @@ class UploadPlaceholderForm(FlaskForm):
return False
data = self.get_data_file()
if not data:
return False
header = [
'Phid',