Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIXTE-25 error message displayed when no file is attached on Quick TXC #7

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading