使用dropzone.js和django大括号简化将多个图像上载到collection对象中的过程。
django-dropimages的Python项目详细描述
#Django DropImages公司# 使用[dropzone.js](http://www.dropzonejs.com/)和[django braces](https://github.com/brack3t/django-braces)简化将多个图像上载到集合对象中的过程。
##安装
使用pip从pypi安装
pip安装–预django dropimages ##文件
将“django_dropimages”添加到已安装的应用程序列表中。 在url.py中添加url(r'^u dropimages',include(django_dropimages.url)), 在模板的开头添加加载javascripts的位置,
以及希望dropzone显示的位置。 每个放入dropzone的图像文件都将创建一个包含在dropimagesgallery中的dropimagesimage模型。
对于每个dropzone实例都是唯一的。
您可以自定义以指定哪个模型将保存图像,而不是dropimagesimage
##配置 提供一个设置字典,您可以将其添加到项目的“设置”模块中以自定义其行为。
###放置图像配置
####按键:
完整显示ID
Specify a DOM node id which will be set to ‘display: block’ once all the files are processed, useful to integrate the dropzone into another modelform or wizard (see the examples).
图库字段ID
Specify the id of a select field to be filled with the DropimagesGallery Django instance pk once the upload is complete, useful to integrate the dropzone into another modelform or wizard (see the examples).
上传网址
Overrides the url where file data is POSTed, so you can use your own view to save the data. An option ?gallery_id is automatically appended to the url, which is the same for every file uploaded but unique among different dropzone instances.
删除URL
Overrides the url to ask for immediate image removal from the dropzone, so you can use your own view. Two options are automatically appended to the url; ?gallery_id which is the same for every file into the dropzone but unique among different dropzone instances, and original_filename which should be saved into DropimagesImage or whichever model you use to save images in order to identify them.
dropimage\u模型
Use the specified model ( must be a appname.ModelName string ) to save the uploaded images. Model must have a ForeignKey to dropimages.DropImagesGallery called dropimages_gallery and a dropimages_original_filenameCharField.
dropimage\u字段
Save the image into the specified field name of the DROPIMAGE_MODEL model.
dict默认消息
The message that gets displayed before any files are dropped.
##示例 导航示例页面(假设使用[virtualenvwrapper](https://pypi.python.org/pypi/virtualenvwrapper)):
mkvirtualenv django-dropimages pip install example/requirements.txt add2virtualenv . python example/manage.py migrate python example/manage.py runserver