Snippet List
Django Filebrowser (http://code.google.com/p/django-filebrowser/) provides a signal called filebrowser_post_upload. Adding this method to a model that has a FileBrowse field will cause uploaded .zip files to be detected and unzipped on the server in place, then deleted (leaving their folder behind). It will also delete the garbage __MACOSX folder created by Mac zip files.
This is probably not safe to do for publicly uploaded files. The use case here was to allow journalists to upload entire SoundSlides projects into a custom CMS.
In order to integrate Wymeditor with the Django filebrowser, put the code in a file, set the fb_url variable to point to your filebrowser instance and add the file to your Javascript headers:
<script type="text/javascript" src="/media/wymeditor/plugins/jquery.wymeditor.filebrowser.js"></script>
or in your admin.py:
class Media:
js = ('/media/wymeditor/plugins/jquery.wymeditor.filebrowser.js',)
Add the postInitDialog parameter to the Wymeditor initialization:
$('textarea').wymeditor({
postInitDialog: wymeditor_filebrowser
});
If you already have a postInitDialog function, you need to put a call to wymeditor_filebrowser inside that function. Then you should be able to click on the Filebrowser link to select an image.
- javascript
- images
- wymeditor
- filebrowser
2 snippets posted so far.