{ "info": { "author": "Z. Alem", "author_email": "alem@cidola.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "Note: This project is forked from https://github.com/jpic/django-jfu. This fork aims to localize the project and keep it compatible with recent versions of Django. It also updates some rather obsolete dependencies.\n\n----------------------------------------------------\nDjango-JFU - A Django Library for jQuery File Upload \n----------------------------------------------------\n\nDjango-JFU is designed to simplify the tasks involved in integrating jQuery\nFile Upload (https://github.com/blueimp/jquery-file-upload) into Django.\nDjango-JFU assumes very little and leaves the model/view design up to the user. \n\nOther Django - jQuery File Upload implementations are full-featured but\ngenerally serve more as demonstrations than libraries for existing\napplications.\n\nIf you seek a tool to ease the integration of jQuery File Upload into your\nDjango application while still having a great degree of freedom, you may find\nthis package useful.\n\nDemo_\n\n.. _Demo: http://djfu-demo.cidola.com\n\nInstallation\n------------\n\n1. ``pip install django-jfu``.\n2. Add 'jfu' to ``INSTALLED_APPS`` in your project settings.py file.\n3. Run `python manage.py collectstatic`.\n\n\nUsage\n-----\n\nDjango-JFU provides simple customizable template tags and override-able\ntemplates that do the work of integrating the jQuery File Upload CSS and\nJavaScipt and the HTML implementation found in the jQuery File Upload demo.\n\nTo place the jQuery File Upload widget in a template, simply insert the\nfollowing within it::\n\n {% load jfutags %}\n {% jfu %}\n\nThen create a view that will handle the uploaded files. \nThe URL for the view is expected to be named **'jfu_upload'** by default,\nalthough this can be customized (see Customization below).\n\nHere is an example implementation:\n\nIn your ``urls.py`` file::\n\n ...\n url( r'upload/', views.upload, name = 'jfu_upload' ),\n\n # You may optionally define a delete url as well\n url( r'^delete/(?P\\d+)$', views.upload_delete, name = 'jfu_delete' ),\n\nIn your ``views.py`` file::\n\n import os\n from django.conf import settings\n from django.core.urlresolvers import reverse\n from django.views import generic\n from django.views.decorators.http import require_POST\n from jfu.http import upload_receive, UploadResponse, JFUResponse\n\n from YOURAPP.models import YOURMODEL\n\n @require_POST\n def upload( request ):\n\n # The assumption here is that jQuery File Upload\n # has been configured to send files one at a time.\n # If multiple files can be uploaded simulatenously,\n # 'file' may be a list of files.\n file = upload_receive( request )\n\n instance = YOURMODEL( file = file )\n instance.save()\n\n basename = os.path.basename( instance.file.path )\n\n file_dict = {\n 'name' : basename,\n 'size' : file.size,\n\n 'url': settings.MEDIA_URL + basename,\n 'thumbnailUrl': settings.MEDIA_URL + basename,\n\n 'deleteUrl': reverse('jfu_delete', kwargs = { 'pk': instance.pk }),\n 'deleteType': 'POST',\n }\n\n return UploadResponse( request, file_dict )\n\n @require_POST\n def upload_delete( request, pk ):\n success = True\n try:\n instance = YOURMODEL.objects.get( pk = pk )\n os.unlink( instance.file.path )\n instance.delete()\n except YOURMODEL.DoesNotExist:\n success = False\n\n return JFUResponse( request, success )\n\nCustomization\n-------------\n\nDjango-JFU is designed to be very customizable. \n\nThe Django-JFU template tag optionally takes two arguments: the name of the\ntemplate to load and the name of the URL pointing to the upload-handling\nview.::\n\n {% load jfutags %}\n {% jfu 'your_fileuploader.html' 'your_uploader_URL_name' %}\n\nA custom template can extend from the master Django-JFU template\n`jfu/upload_form.html`. There are several blocks which may be overriden for\nthe purpose of customization:\n\n* JS_OPTS - The options supplied to the jQuery File Upload ``fileupload`` function. \n* JS_INIT - The initializing JavaScript\n* FILE_INPUT - The file input for the upload form.\n\nThe blocks above are most-likely what you will want to override when seeking to\ncustomize. For instance, one would go about adding a few options to the\nfileupload function in this manner::\n\n # your_fileuploader.html\n {% extends 'jfu/upload_form.html' %}\n\n {% block JS_OPTS %}\n autoUpload: true,\n maxNumberOfFiles: 5,\n sequentialUploads: true,\n {% endblock %}\n\nThere are several other blocks too:\n\n\nHTML Components\n===============\n\n* MODAL_GALLERY - The modal gallery\n* UPLOAD_FORM - The file upload form used as target for the file upload widget.\n\n * UPLOAD_FORM_LISTING - The table listing the files available for upload/download.\n * UPLOAD_FORM_LINDICATOR - The loading indicator shown during file processing.\n * UPLOAD_FORM_PROGRESS_BAR - The global progress information.\n * UPLOAD_FORM_BUTTON_BAR - The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload.\n\n * UPLOAD_FORM_BUTTON_BAR_CONTROL - Contains buttons to start/cancel the upload or delete files. \n * UPLOAD_FORM_BUTTON_BAR_ADD - Contains the file input used to add files.\n * FILE_INPUT or UPLOAD_FORM_BUTTON_BAR_ADD_FILE_INPUT - Contains the file input.\n * UPLOAD_FORM_BUTTON_BAR_ADD_EXTRA - An empty block allowing the addition of extra inputs.\n * UPLOAD_FORM_BUTTON_BAR_EXTRA - An empty block allowing the addition of extra components.\n\n * UPLOAD_FORM_EXTRA - An empty block allowing the addition of extra components.\n\nCSS Components\n==============\n\n* CSS\n\n * CSS_BOOTSTRAP \n * CSS_BLUEIMP_GALLERY \n * CSS_JQUERY_FILE_UPLOAD\n * CSS_JQUERY_FILE_UPLOAD_UI\n * CSS_HTML5_SHIM \n * CSS_EXTRA \n\nJS Components\n=============\n\n* JS_TEMPLATES \n\n * JS_DOWNLOAD_TEMPLATE \n\n * JS_DOWNLOAD_TEMPLATE_DELETE \n * JS_DOWNLOAD_TEMPLATE_DOWNLOAD \n * JS_DOWNLOAD_TEMPLATE_PREVIEW \n * JS_DOWNLOAD_TEMPLATE_ERROR \n * JS_DOWNLOAD_TEMPLATE_FSIZE \n\n * JS_UPLOAD_TEMPLATE \n * JS_UPLOAD_TEMPLATE_PREVIEW\n * JS_UPLOAD_TEMPLATE_UPLOAD\n * JS_UPLOAD_TEMPLATE_CONTROLS\n * JS_UPLOAD_TEMPLATE_START\n * JS_UPLOAD_TEMPLATE_CANCEL\n * JS_UPLOAD_TEMPLATE_PROGRESSBAR\n\n* JS_SCRIPTS \n\n * JS_JQUERY \n * JS_JQUERY_UI_WIDGET\n * JS_TEMPLATES_PLUGIN\n * JS_LOAD_IMAGE\n * JS_CANVAS_TO_BLOB \n * JS_BOOTSTRAP \n * JS_BLUEIMP_GALLERY \n * JS_BOOTSTRAP_IFRAME_TRANSPORT\n * JS_JQUERY_FILE_UPLOAD\n * JS_JQUERY_FILE_UPLOAD_FP\n * JS_JQUERY_FILE_UPLOAD_IMAGE\n * JS_JQUERY_FILE_UPLOAD_AUDIO\n * JS_JQUERY_FILE_UPLOAD_VIDEO\n * JS_JQUERY_FILE_UPLOAD_VALIDATE\n * JS_JQUERY_FILEUPLOAD_UI \n * JS_XDR_TRANSPORT \n * JS_EXTRA\n\nThe included JavaScript and CSS can be updated or suppressed by overriding\nthese blocks ::\n\n # your_fileuploader.html\n {% extends 'jfu/upload_form.html' %}\n\n {% block JS_JQUERY %}\n