使用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, 或者完全重写调用的url并使用自己的逻辑。

##配置 提供一个设置字典,您可以将其添加到项目的“设置”模块中以自定义其行为。

###放置图像配置

####按键:

  • 完整显示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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在Rxjava中更改列表时通知obsever   java如何验证spring MVC web app中是否设置了连接池?   从Textview选择文本时出现安卓错误(java.lang.IndexOutOfBoundsException:setSpan(1…1)在0之前开始)   javakotlin:作为方法参数的接口   java将列强制转换为hibernate条件中的类型   java如何在屏幕上获取输出对象?   java内部调用方法   java Log4j2模式布局+转换模式处的负数   java将EditText转换为浮动安卓 eclipse   对Java继承规则感到困惑   java将外部文件打包到jar中,然后允许代码对这些打包的文件执行操作   java如何通过输入给定字段之一进行用户搜索?   java Android从应用程序调用活动   java如何从相机中获取图像并将其添加到google地图上作为标记?   java自定义Listview在选择Edittext并打开键盘之前不显示   javascript验证JSON字符串服务端   使用java流从列表中获取素数   java无法让我的菜单打开方法   用户界面高效的动态生成Java GUI