Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate multiple image uploading with UPLOADIFY in django administration?

I met the django-uploadify (multiple file uploading) application, but the only template-use is described in wiki of the project. I need to integrate it with django admin. Any ideas?

like image 900
megido Avatar asked Jun 03 '11 04:06

megido


2 Answers

@rebus and @Mordi have good suggestions; one of those is probably your best bet. Still...

The current implementation of file uploads in web browsers is single file only. That's a limitation of the HTML standards and the browsers themselves. When you see multiple file upload capability (all at once / select multiple) in some web app, something like Flash or Java is in play. You could potentially use a Flash or Java applet (check out Uploadify - about the easiest to work with you'll find), if you wanted, but you'd have to do some work tying it into Django: namely mapping the output of the applet to the input the Django Admin expects on POST.

like image 148
Chris Pratt Avatar answered Nov 16 '22 02:11

Chris Pratt


Personally I found this package to be painful when I attempted to do this locally. It is 7 years old and not maintained. django-filer is a more modern implementation that has this exact functionality built into the admin panel, it was quick to set up and it seems to be maintained a lot better. And the UI is excellent!

If your really set on using uploadify my attempt was quite painful. When I went to the website to download the uploadify jQuery plugin it was a paid download. After looking a bit I found a fork, and was able to get it going locally, but because the python package is old it required a lot of changes from python 2.7..

To integrate this with your project in the admin will definitely require you to write your own custom admin template. In your admin.py you would have to override the default template and methods, this faq has some insights. In your new template you would include the uploadify jquery script and put the upload file field inside the form where your model fields would be. When you upload files the signal sender in the package will fire, and you would just have to intercept the signal and handle it with your intended logic

like image 30
wdfc Avatar answered Nov 16 '22 01:11

wdfc