
* new style with picocss * djlint * rate distribution * collection item drag to order * discover available for guest * search combine movie tv
21 lines
655 B
HTML
21 lines
655 B
HTML
<input type="{{ widget.type }}"
|
|
name="{{ widget.name }}"
|
|
{% include "django/forms/widgets/attrs.html" %}>
|
|
<img src="{{ widget.value|default_if_none:''|stringformat:'s' }}"
|
|
alt=""
|
|
id="previewImage"
|
|
style="margin:10px 0;
|
|
max-width:500px">
|
|
<script>
|
|
$("input[type='file'][name='{{ widget.name }}']").on("change", function () {
|
|
if (this.files && this.files[0]) {
|
|
var reader = new FileReader();
|
|
|
|
reader.onload = function (e) {
|
|
$('#previewImage').attr('src', e.target.result);
|
|
}
|
|
|
|
reader.readAsDataURL(this.files[0]);
|
|
}
|
|
});
|
|
</script>
|