helloflask / flask-dropzone

Upload files in Flask application with Dropzone.js.
https://flask-dropzone.readthedocs.io
MIT License
250 stars 69 forks source link

Proper way to use dynamic custom config. #37

Closed c0per closed 4 years ago

c0per commented 4 years ago

I want to use some custom init in dropzone. I can only come up with only one bad way. Since Jinja doesn't support statements (if, for) in {{ dropzone.config(custom_init = '') }} because it's a variable, I have to put up some js code using python in Flask view functions. Any better way?

greyli commented 4 years ago

Actually, you can set the variable before pass it to custom_init in Jinja with {% set %}. What's your JS code look like?

c0per commented 4 years ago

Ah I see. It's some js preloading images already stored on server, when editing images for a specific item.

btw I'm starting to use Flask based on your book. Keep up the great works. It's a good book for beginners.