Skip to content

Instantly share code, notes, and snippets.

@d-demirci
Created May 26, 2020 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d-demirci/a5311fcb701b08df55827bf701155b36 to your computer and use it in GitHub Desktop.
Save d-demirci/a5311fcb701b08df55827bf701155b36 to your computer and use it in GitHub Desktop.
clearable_file_input.html django/forms/widgets/ file upload bootstrap css
<!-- https://stackoverflow.com/questions/44675550/django-widget-override-template -->
{% load i18n %}{% if widget.is_initial %}{{ widget.initial_text }}: <a href="{{ widget.value.url }}">{{ widget.value }}</a>{% if not widget.required %}
<input type="checkbox" name="{{ widget.checkbox_name }}" id="{{ widget.checkbox_id }}">
<label for="{{ widget.checkbox_id }}">{{ widget.clear_checkbox_label }}</label>{% endif %}<br>
{{ widget.input_text }}:{% endif %}
<label class="btn btn-primary">{% trans 'Upload' %}<input type="{{ widget.type }}" name="{{ widget.name }}" hidden {% include "django/forms/widgets/attrs.html" %}> </label>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment