我想在我想要提交文件的表单中实现拖放功能。我的模板看起来像:
{% extends "admin/base_site.html" %}
{% load staticfiles %}
{% block content %}
<link rel="stylesheet" href="{% static "css/dropzone.css" %}">
<form id='my-awesome-dropzone' class="dropzone" method="post" action="" enctype="multipart/form-data">{% csrf_token %}
{{ form.files }}
</form>
<button id="submit-all">
Submit all files
</button>
{% endblock %}
<script src="{% static "js/dropzone.js" %}"></script>
<script type="text/javascript">
Dropzone.options.myDropzone = {
autoProcessQueue: false,
paramName: "files",
uploadMultiple: true,
parallelUploads: 100,
maxFilesize: 5,
maxFiles: 10,
init : function() {
var submitButton = document.querySelector("#submit-all")
myDropzone = this;
submitButton.addEventListener("click", function() {
myDropzone.processQueue();
// Tell Dropzone to process all queued files.
});
// You might want to show the submit button only when
// files are dropped here:
this.on("addedfile", function() {
// Show submit button here and/or inform user to click it.
});
}
};
</script>
我真的得到了css但是我仍然得到了浏览按钮而不是拖放空间.. Css占用了它的空间但是没有删除浏览按钮?
我做错了吗? 需要帮助?