I am using Dropzone.js and Django to upload files and process it and show messages based on processes which are done in the server side, How I can send the messages from Django view to my dropzone component, I can see that there is a red cross when the server generates an error, how I can put my own message on that? This is my view:
@login_required
def upload_file(request):
error=''
if request.method == 'POST' and request.FILES['file'] :
##doing something and based on that generate error
error='My message.....'
return render(request,'app/inputFile_pannel.html', {
'error':error})
return render(request,'app/inputFile_pannel.html', {
'error':error})
and this is the dropzone options in the template file:
Dropzone.options.myDropzone = {
clickable:true,
method:"post",
withCredentials:true,
paramName: 'file',
autoProcessQueue :false,
uploadMultiple:false,
forceFallback:false
}
and this is the form in my template:
<form method="POST" action="{% url 'upload_file' %}" enctype="multipart/form-data" class="dropzone" id="myDropzone" >
{% csrf_token %}
when I want to show the error using {{error}} in the template it doesn't work, when I change the forceFallback to true everything is working well and the errors are shown properly, but the form changes to simple file input and is not a dropzone any more. How I can send my messages from view to this template? Is it possible to have access to the red cross message which is appeared in thumbnail files in dropzone? could anybody help?