{ "info": { "author": "Peter Kuma", "author_email": "peterkuma@waveland.org", "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", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "django-attach\n=============\n\ndjango-attach is a django admin plugin for attaching files to model instances\nwith multiple file selection support. Its main feature is a custom admin inline\nform. Requires a modern browser supporting HTML5 and XMLHttpRequest2,\nbut falls back to the plain django inline form when these are not available.\n\n### Features:\n\n* Mutiple file selection.\n* Files are not uploaded or deleted until the form is submitted.\n* Properly handles both editing existing model instances, and adding new\n model instances (incl. validation errors, when uploaded files remain\n associated with a temporary object until the errors are corrected,\n and the instance can be saved).\n* Reports upload progress.\n* Reports any errors in asynchronous requests if they occur.\n\nInstallation\n------------\n\nInstall from PyPI or with `setup.py`:\n\n pip install django-attach\n\n # Alternatively:\n python setup.py install\n\nAdd the application to `settings.py`:\n\n INSTALLED_APPS = (\n ...\n 'django_attach',\n # You apps follow here.\n ...\n )\n\nInitialize database tables and copy static files:\n\n python manage.py syncdb\n python manage.py collectstatic\n\nAdd a generic relation field to your model:\n\n from django_attach.models import Attachment\n from django.contrib.contenttypes.generic import GenericRelation\n ...\n\n class MyModel(models.Model):\n ....\n attachments = GenericRelation(Attachment)\n\nThis is how you can access attachments in your program.\n\nIn `admin.py` of your application, add **AttachmentInline** to the list of\ninlines:\n\n from django_attach.forms import AttachmentInline\n ...\n\n class MyModelAdmin(admin.ModelAdmin):\n inlines = (AttachmentInline,)\n\nIn the admin, you should be able to see the attachment inline under the\nchange and add pages of your model. You should also see a new application\nDjango_Attach, where you can edit the raw attachments and temporary objects\n(described below) if you ever need to.\n\nIt is up to you to implement a meaningful way in which the attachments are\nused. One possible use is to allow text fields (e.g. article HTML content)\nof the model to reference them directly. You then have to supply a view\nwhich serves the files (e.g. via HTTP redirect) under the appropriate URL.\nYou may also need to pipe the HTML content through a filter which modifies\nthe relative links to absolute links (if you display multiple models\nunder one URL).\n\nBrowser support\n---------------\n\nThis is an early release of django-attach. As such, it has not been tested\nthoroughly on many browsers.\n\n**Known to work:**\n\n* Firefox 23\n* Chromium 27\n\n**Partial:**\n\n* Safari 6 on Mountain Lion (allows selection of only 1 file at a time)\n\n**Fallback to classic formset inline:**\n\n* IE7\n* IE8\n* IE9\n\n**Broken:**\n\n* IE10\n\nExample\n-------\n\nDirectory [example_project](example_project) contains an example\ndjango project demonstrating the use of django-attach.\nPlease see `example_project/README.md` for more information.\n\nReference\n---------\n\n### class Attachment(Model)\n\nAttachment objects hold individual files. They are associated with arbitrary\nmodel instances via the\n[contenttypes](https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/)\nframework.\n\n**Fields**:\n\n- **file** - attachment file.\n- **content_object** - object associated with the attachment.\n- **content_type** - ID of ContentType of the associated model.\n- **object_id** - primary key of the associated model.\n- **created** - datetime when attachment was created.\n- **modified** - datatime when attachment was last modified.\n\nYou should not rely on file, content\\_object, content\\_type and object\\_id\nnot being null.\n\n### class Temporary(Model)\n\nTemporary objects. Files attached to instances yet to be saved are associated\nwith temporary objects. They are removed once the instance is saved.\n\n**Fields**:\n\n- **attachments** - attachments associated with the temporary object.\n- **created** - datetime when temporary object was created.\n- **modified** - datetime when temporary object was last modified.\n\n### Settings\n\n#### ATTACHMENT_ROOT\n\nDefault: 'attachment'\n\nPath where attachments are stored (relative to `MEDIA_ROOT`).\n\nHow it works\n------------\n\nFile selection upon clicking Attach button is implemented using a hidden\n``. Files are uploaded asynchronously\nwhen the model form is submitted. If the instance is yet to be created,\nthey are associated with a new Temporary object. Once the model instance\nis saved, they are re-attached to the instance, and moved in the file storage\nto the appropriate location (`MEDIA_ROOT/attachment///`).\nFile deletion is implemented using the ordinary hidden *-DELETE fields\nas in inline formset, submitted synchronously on model form submission.\n\nKnown issues\n------------\n\n* Stale files (uploaded via the add page of your model, but whose associated\nmodel instance was not eventually saved) need to be removed manually in the\nDjango_Attach application in the admin. This can be done by removing the old\nTemporary objects they are attached to.\n* django-attach is not yet fully translatable.\n\nSecurity considerations\n-----------------------\n\n* django-attach is bundled with minified versions of JavaScript libraries\n [d3.js](http://d3js.org/) and [queue](https://github.com/mbostock/queue)\n downloaded from [github.com/mbostock](https://github.com/mbostock).\n* django-attach has not yet been well tested with respect to honoring\n django admin model permissions.\n\nLicense\n-------\n\ndjango-attach is released under the BSD License.\nSee `LICENSE` and `LICENSE.third-party` for details.\n\nScreenshots\n-----------\n\nAttachmentInline displays a list of attachments on a model change page.\nAttachments can be added by clicking the `Attach file` button, and removed\nby clicking a cross next to a file name.\n\n![](https://github.com/peterkuma/django-attach/raw/master/screenshots/1.png)\n\nNew attachments are uploaded asynchronously when form is submitted. Upload\nprogress is shown.\n\n![](https://github.com/peterkuma/django-attach/raw/master/screenshots/2.png)\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/peterkuma/django-attach/", "keywords": null, "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "django-attach", "package_url": "https://pypi.org/project/django-attach/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-attach/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/peterkuma/django-attach/" }, "release_url": "https://pypi.org/project/django-attach/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "Django admin plugin for attaching files to model instances with multiple file selection support", "version": "0.1.3" }, "last_serial": 862936, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "45891de427558bc61d4735667d24f4e9", "sha256": "351678d54d7ca26c0e868201a8442c901962ded43774bc93ff96b5efa423d27a" }, "downloads": -1, "filename": "django-attach-0.1.tar.gz", "has_sig": false, "md5_digest": "45891de427558bc61d4735667d24f4e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 60304, "upload_time": "2013-09-06T11:04:59", "url": "https://files.pythonhosted.org/packages/40/73/48a88ff035b1997fc89dd3202d35ca4c017d1bd34a3bcc126759605a8489/django-attach-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "31608d537803094a5d692140c1f28cc9", "sha256": "450d39460474d45ad82e4ca07b038c9ae3658e1bf2cf37ef12bdf9266ce1ca51" }, "downloads": -1, "filename": "django-attach-0.1.1.tar.gz", "has_sig": true, "md5_digest": "31608d537803094a5d692140c1f28cc9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 170169, "upload_time": "2013-09-06T11:10:40", "url": "https://files.pythonhosted.org/packages/22/5e/d2e8a691ece56618113610f0e51e46c412f2970165377ad5492f0bc3447b/django-attach-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "ce975ed376413efa0563294b9af3c35f", "sha256": "8afe88499f78ac73487a9aaeb806d2217d81cd325fd2403588104ab8198912bc" }, "downloads": -1, "filename": "django-attach-0.1.2.tar.gz", "has_sig": true, "md5_digest": "ce975ed376413efa0563294b9af3c35f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 170268, "upload_time": "2013-09-06T18:35:12", "url": "https://files.pythonhosted.org/packages/52/7e/0115a691c0ce545720b3b0e14eed86995224f2ae3ca467cf5beb73e3c4b2/django-attach-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "183ce6a1fbcd9b53d4bc829ad34f55dd", "sha256": "5dc2db32d28a0f44bf8d15b59874ff80caa9912c89d79f3a03337285ecf2cfe9" }, "downloads": -1, "filename": "django-attach-0.1.3.tar.gz", "has_sig": false, "md5_digest": "183ce6a1fbcd9b53d4bc829ad34f55dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 166443, "upload_time": "2013-09-11T17:44:58", "url": "https://files.pythonhosted.org/packages/ea/0b/44bb89a652507dc2c5e77219a85805b57a58d4f81caf5dd56b162cd04d6b/django-attach-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "183ce6a1fbcd9b53d4bc829ad34f55dd", "sha256": "5dc2db32d28a0f44bf8d15b59874ff80caa9912c89d79f3a03337285ecf2cfe9" }, "downloads": -1, "filename": "django-attach-0.1.3.tar.gz", "has_sig": false, "md5_digest": "183ce6a1fbcd9b53d4bc829ad34f55dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 166443, "upload_time": "2013-09-11T17:44:58", "url": "https://files.pythonhosted.org/packages/ea/0b/44bb89a652507dc2c5e77219a85805b57a58d4f81caf5dd56b162cd04d6b/django-attach-0.1.3.tar.gz" } ] }