Merge pull request #4089 from alphagov/flash-upload-errors-177535141

Show flash instead of inline upload errors
This commit is contained in:
Ben Thorner
2021-12-08 10:03:06 +00:00
committed by GitHub
5 changed files with 14 additions and 3 deletions

View File

@@ -175,6 +175,11 @@ def send_messages(service_id, template_id):
).format(
form.file.data.filename
))
elif form.errors:
# just show the first error, as we don't expect the form to have more
# than one, since it only has one field
first_field_errors = list(form.errors.values())[0]
flash(first_field_errors[0])
column_headings = get_spreadsheet_column_headings_from_template(template)

View File

@@ -417,6 +417,11 @@ def upload_contact_list(service_id):
).format(
form.file.data.filename
))
elif form.errors:
# just show the first error, as we don't expect the form to have more
# than one, since it only has one field
first_field_errors = list(form.errors.values())[0]
flash(first_field_errors[0])
return render_template(
'views/uploads/contact-list/upload.html',