API Reference¶
Dropzone Object in Template¶
-
class
flask_dropzone._Dropzone¶ -
static
config(redirect_url=None, custom_init='', custom_options='', nonce=None, id=None, **kwargs)¶ Initialize dropzone configuration.
Changed in version 1.5.4: Added
idparameter.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
idargument passed todropzone.create()if provided. - **kwargs –
Mirror configuration variable, lowercase and without prefix. For example,
DROPZONE_UPLOAD_MULTIPLEbecomesupload_multiplehere.
-
static
create(action='', csrf=False, action_view='', id=None, **kwargs)¶ Create a Dropzone form with given action.
Changed in version 1.4.2: Added
csrfparameter to enable CSRF protect.Changed in version 1.4.3: Added
actionparameter to replaceaction_view,action_viewwas deprecated now.Changed in version 1.5.0: If
DROPZONE_IN_FORMset toTrue, create<div>instead of<form>.Changed in version 1.5.4:
csrfwas deprecated now.Changed in version 1.5.4: Added
idparameter.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
idargument 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_urlandcss_urlparameters 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.2.0')¶ 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.2.0')¶ 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)¶ Add css to dropzone.
Parameters: css – style sheet code.
-
static