API Reference¶
Dropzone Object in Template¶
-
class
flask_dropzone.
_Dropzone
¶ -
static
config
(redirect_url=None, custom_init='', custom_options='', nonce=None, id='myDropzone', **kwargs)¶ Initialize dropzone configuration.
Changed in version 1.5.4: Added
id
parameter.New in version 1.4.4.
Parameters: - redirect_url – The URL to redirect when upload complete.
- custom_init – Custom javascript code in
init: function() {}
. - custom_options – Custom javascript code in
Dropzone.options.myDropzone = {}
. - nonce – Pass a nonce value that is newhen embedding the JavaScript code into a Content Security Policy protected web page.
- id – The id of the dropzone element, it must matches the
id
argument passed todropzone.create()
if provided. - **kwargs –
Mirror configuration variable, lowercase and without prefix. For example,
DROPZONE_UPLOAD_MULTIPLE
becomesupload_multiple
here.
-
static
create
(action='', csrf=False, action_view='', id='myDropzone', **kwargs)¶ Create a Dropzone form with given action.
Changed in version 1.4.2: Added
csrf
parameter to enable CSRF protect.Changed in version 1.4.3: Added
action
parameter to replaceaction_view
,action_view
was deprecated now.Changed in version 1.5.0: If
DROPZONE_IN_FORM
set toTrue
, create<div>
instead of<form>
.Changed in version 1.5.4:
csrf
was deprecated now.Changed in version 1.5.4: Added
id
parameter.Parameters: - action – The action attribute in
<form>
, pass the url which handle uploads. - csrf – Enable CSRF protect or not, same with
DROPZONE_ENABLE_CSRF
, deprecated since 1.5.4. - action_view – The view which handle the post data, deprecated since 1.4.2.
- id – The id of the dropzone element, it must matches the
id
argument passed todropzone.config()
if provided.
- action – The action attribute in
-
static
load
(js_url='', css_url='', version='5.2.0')¶ Load Dropzone resources with given version and init dropzone configuration.
Changed in version 1.4.3: Added
js_url
andcss_url
parameters to pass custom resource URL.Changed in version 1.4.4: This method was deprecated due to inflexible. Now it’s divided into three methods: 1. Use
load_css()
to load css resources. 2. Useload_js()
to load js resources. 3. Useconfig()
to configure Dropzone.Parameters: - js_url – The JavaScript url for Dropzone.js.
- css_url – The CSS url for Dropzone.js.
- version – The version of Dropzone.js.
-
static
load_css
(css_url=None, version='5.9.2')¶ Load Dropzone’s css resources with given version.
New in version 1.4.4.
Parameters: - css_url – The CSS url for Dropzone.js.
- version – The version of Dropzone.js.
-
static
load_js
(js_url=None, version='5.9.2')¶ Load Dropzone’s js resources with given version.
New in version 1.4.4.
Parameters: - js_url – The JS url for Dropzone.js.
- version – The version of Dropzone.js.
-
static
style
(css, id=None)¶ Add css to dropzone.
Changed in version 1.7.0: Added
id
parameter.Parameters: - css – style sheet code.
- id – The id of the dropzone element, it must matches the
id
argument passed todropzone.create()
.
-
static