<input placeholder="{{ widget.tag_args.placeholder }}" autocomplete="off" type="{{ widget.type }}"
       name="{{ widget.name }}"{% if widget.value != None %}
       value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} />
<script>
    let args = {
        delimiters: "{{widget.tag_args.delimiters}}",
        whitelist: {{widget.tag_args.whitelist|safe}},
        suggestionsMinChars:{{widget.tag_args.suggestionsMinChars}},
        blacklist:{{widget.tag_args.blacklist|safe}},
        originalInputValueFormat: valuesArr => valuesArr.map(item => item.value).join('{{ widget.tag_args.delimiters }}')

    }
    {% if widget.tag_args.maxTags != None %}args.maxTags={{widget.tag_args.maxTags}}{%endif%}
    {% if widget.tag_args.pattern %}args.pattern=/{{widget.tag_args.pattern}}/{%endif%}

    {% if widget.tag_args.var_name %}
        var {{widget.tag_args.var_name}} = {% endif %}  new Tagify(document.querySelector('input[name={{widget.name}}]'), args)
</script>