Skip to content

Commit

Permalink
#300 fixed getting public api in the file uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
egordidenko committed Dec 26, 2024
1 parent 1a1b08a commit 960405e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pyuploadcare/dj/templates/uploadcare/forms/widgets/file.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
<script>
window.addEventListener('DOMContentLoaded', (e) => {
const uploaderCtx = document.querySelector('#uploaderctx_{{ name }}');
const api = uploaderCtx.getAPI();
{% if options.multiple == "true" %}
{# FileGroup #}
{% for file in value %}
uploaderCtx.addFileFromCdnUrl("{{ file.cdn_url }}")
api.addFileFromCdnUrl("{{ file.cdn_url }}")
{% endfor %}
{% else %}
{# File #}
uploaderCtx.addFileFromCdnUrl("{{ value.cdn_url }}")
api.addFileFromCdnUrl("{{ value.cdn_url }}")
{% endif %}
});
</script>
Expand Down

0 comments on commit 960405e

Please sign in to comment.