Skip to content

Commit

Permalink
[#5152] Use data to pass the previous_upload var
Browse files Browse the repository at this point in the history
Otherwise when using errors it is shown on the error summary on top when
using scheming
  • Loading branch information
amercader committed Jan 10, 2020
1 parent 6a3f753 commit c20dd8b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ckan/templates/package/snippets/resource_form.html
Expand Up @@ -24,7 +24,7 @@
{{ form.image_upload(data, errors, field_url='url', field_upload='upload', field_clear='clear_upload',
is_upload_enabled=h.uploads_enabled(), is_url=data.url and not is_upload, is_upload=is_upload,
upload_label=_('Data'), url_label=_('URL'), placeholder=_('http://example.com/external-data.csv'), field_name='name',
previous_upload=(errors['previous_upload'] == True)
previous_upload=(data['previous_upload'] == True)
) }}
{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion ckan/views/resource.py
Expand Up @@ -246,7 +246,7 @@ def post(self, package_type, id):
if data.get(u'url_type') == u'upload' and data.get(u'url'):
data[u'url'] = u''
data[u'url_type'] = u''
errors[u'previous_upload'] = True
data[u'previous_upload'] = True
return self.get(package_type, id, data, errors, error_summary)
except NotAuthorized:
return base.abort(403, _(u'Unauthorized to create a resource'))
Expand Down

0 comments on commit c20dd8b

Please sign in to comment.