Skip to content

Commit

Permalink
Merge pull request #7 from keitaroinc/VIXTE-25-error-msg-on-empty-file
Browse files Browse the repository at this point in the history
VIXTE-25 error message displayed when no file is attached on Quick TXC
  • Loading branch information
FilipMitrovski authored Aug 13, 2024
2 parents 0fb6c9b + d0bac13 commit 289032d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
{% block primary_content %}
<p> </p>
{% block form %}
{% if errors %}
<p class="text-danger">Please choose a file</p>
{% endif %}
<form id="bulk_upload_form" method="post" enctype="multipart/form-data">
{{ form.input('title', id='field-dataset-title', label=_('Dataset Title'), value=pkg_dict.title, error="", placeholder='eg. TransX data') }}
<div style="margin:-20px 0px 20px 0px;"><small>{{ form.info('The name of the dataset') }}</small></div>
Expand Down
6 changes: 6 additions & 0 deletions ckanext/bulkupload/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ def bulk_resource_upload(pkg_name):
pkg_dict = get.package_show(context, pkg_name_dict)
uploaded_files = flask.request.files.getlist("file[]")

if not uploaded_files or not any(f for f in uploaded_files):
errors = 'Please choose a file'
extra_var = {'errors': errors,
'pkg_dict': pkg_dict}
return base.render('package/resource_busoperator.html', extra_var)

# For newly created datasets
if pkg_dict['state'] != 'active':
patch_package_data = {
Expand Down

0 comments on commit 289032d

Please sign in to comment.