{ "info": { "author": "Rajiv Subramanian M", "author_email": "rajiv.m1991@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Django Generic File\r\n===================\r\n\r\nA Generic File Model for all kind of file attachment with AJAX fileupload and drag & drop feature.\r\n\r\n- Attach files to any Model across your project\r\n- Include file upload field in your django templates using our templatetags\r\n- Retrieve back the list of files attached to your Object using our templatetags\r\n\r\nInstallation\r\n------------\r\n::\r\n\r\n pip install django-generic-file\r\n\r\nUsage\r\n-----\r\n\r\n1. Add **\"genericfile\"** to your INSTALLED_APPS and migrate.\r\n\r\n2. Include following static files in your template::\r\n\r\n \r\n \r\n\r\n3. At the top of your template load our template tags::\r\n\r\n {% load genericfiletags %}\r\n\r\nThen to render your form\r\n------------------------\r\n\r\n1. In Your Add Form (basically where object is not yet created / unknown)::\r\n\r\n
\r\n\r\n # then in POST method of your view, \r\n from genericfile.views import update_genericfile\r\n update_genericfile(self.request.POST, self.object)\r\n\r\n2. In Your Edit Form (where object is known)::\r\n\r\n \r\n\r\nOptions\r\n-------\r\n\r\n1. **maxFileCount** - to Restrict Number of files::\r\n\r\n {% get_genericfile_form maxFileCount=1 %}\r\n\r\n # Default is NoLimit\r\n\r\n2. **allowedTypes** - to Restrict File types::\r\n\r\n {% get_genericfile_form allowedTypes=\"jpg,jpeg,png,gif,doc,pdf,zip,html,txt,docx\" %}\r\n\r\n # Default is AnyFiles\r\n \r\nTo get the list of files in Details view\r\n----------------------------------------\r\n::\r\n\r\n {% get_genericfile_list host_object=object as attachments %}\r\n