I wouldn't store binary data like an image in a session, especially if you have a DB-backed session system.
I would instead use a separate model just for the images so that they can be created on the fly by dropzone via an API call, and then you can save the ID of the image object in the session (or update a hidden field in the form) and later attach it to the object you are creating via the form by a foreign key or one-to-one relationship when saving the form object. There would still be other potential issues like the possibility of orphaned images if a user uploads an image but then doesn't complete the form. You may need some sort of nightly cleanup management command to run to do something with the orphan images, like delete them. Also, unless you know or manipulate the images to be small, make sure that you don't store them in the database itself, use the file system. The DB is a bad place for binary data blobs in most situations. -James Hello mates! I tried dropzone.js on my app and everything worked fine. Now I want to use it in a view that loads a form for tthe creation of a new object. The dropzone where the user drop the images should load the images on the server instantly and not when the user submit the form. This approach is easy to do when the object is already in the model, for example when I want to change the profile image of the user, but when the object is not even in the database, how I can upload instantly the images? I though that I could write a view to use with dropzone that get the images and store them in the sessions. Than when the user submit the form, the form object get the images from the session and save them in the new object. Could be a good design pattern? Thank you! -- Karim N. Gorjux -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACeuRGXU0DynH%3D%2BbmGx8Ks_C7ZsyHAn8%3D7TsbRK6TyGTpckEbg%40mail.gmail.com <https://groups.google.com/d/msgid/django-users/CACeuRGXU0DynH%3D%2BbmGx8Ks_C7ZsyHAn8%3D7TsbRK6TyGTpckEbg%40mail.gmail.com?utm_medium=email&utm_source=footer> . For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX3PmfhkTop0EoyGfq5rdBUP9v2_xHBAmKWf8%3DrQTE%2BRA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.