使用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如何在导入到Google工作表时使用ApachePOI显示系列标签   java在Swing表上修改数据生成SQL   java TCP数据包在网络级别合并   java自动连线bean在线程位置为空   javasocket。禁用无线连接时getOutputStream()阻塞   JSON上的javascript字符串数组。stringify输出unicode字符   java在Oracle数据库中存储不同类型数据的最佳体验   Spring MVC中模板引擎后的java进程输出   不知从哪里来的java空字符串。   如何加载java。使用Adobe Flex的客户端的属性文件?   java如何替换多层括号之间的所有内容?   {JSONObject必须以java'开头   java使用commandButton或commandLink返回并管理HTML控件值   java Android大文本视图动态   java JMock需要自定义类   java Android应用程序在emulator中工作,但在设备中失败   java连接到derby数据库时使用什么文件路径格式?   java在一个函数调用中返回两个结果?