{ "info": { "author": "Matt Lenc", "author_email": "matt.lenc@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "djcroco\n=======\n\n.. image:: https://travis-ci.org/mattack108/djcroco.png?branch=master\n :target: https://travis-ci.org/mattack108/djcroco\n\n.. image:: https://pypip.in/v/djcroco/badge.png\n :target: https://pypi.python.org/pypi/djcroco\n\n.. image:: https://pypip.in/d/djcroco/badge.png\n :target: https://pypi.python.org/pypi/djcroco\n\n``djcroco`` is a custom `Django `_ model field to\nadd support for the `Crocodoc API `_.\n\nIt behaves like standard `FileField `_\nso you can still use most of its properties (e.g. ``name``, ``size``, ``url``\netc) while having extra ones to play with Crocodoc API.\n\n``djcroco`` is supported by `Incuna `_ (an awesome company\nI work for!).\n\nRequirements\n------------\n\n- Python 2.6.x, 2.7.x\n- Django 1.3.x, 1.4.x, 1.5.x\n- `crocodoc `_ 0.1.1\n\nPython 3.x will be supported soon!\n\nInstallation\n------------\n\nTo install ``djcroco``, simply run: ::\n\n pip install djcroco\n\nInclude in ``urls.py``: ::\n\n url(r'', include('djcroco.urls')),\n\nDefine Crocodoc API token in ``settings.py``: ::\n\n CROCO_API_TOKEN = ''\n\nOr alternatively as env variable: ::\n\n export CROCO_API_TOKEN=''\n\nWhen optional parameters for URLs are used (see below for more details) - then\nyou need to add ``djcroco`` to ``INSTALLED_APPS``: ::\n\n INSTALLED_APPS += ('djcroco',)\n\nAnd load its template tags in the template you wish to use them in: ::\n\n {% load croco_tags %}\n\nUsage\n-----\n\nDefine the field in model you wish to extend:\n\n.. code-block:: python\n\n from django.db import models\n\n from djcroco.fields import CrocoField\n\n\n class Example(models.Model):\n name = models.CharField(max_length=255)\n document = CrocoField()\n\n def __unicode__(self):\n return self.name\n\n\nCustom thumbnails size\n----------------------\n\nYou can pass ``thumbnail_size`` like so:\n\n.. code-block:: python\n\n document = CrocoField(thumbnail_size=(150, 150))\n\nWhere tuple is represented as *(width, height)*.\n\nIf you do not pass custom thumbnail size, the default will be used (100x100).\nThe maximum dimensions for thumbnail is **300x300**.\n\n\nThumbnail caching\n-----------------\n\nBy default the thumbnail will be generated every time template gets rendered and\nthis involves hitting Crocodoc API for each thumbnail. It could be time\nexpensive if you have many items on a single page. To avoid above issue you\ncan point to a field where the thumbnail will be saved and served from there\nthe next time.\n\n.. code-block:: python\n\n class Example(models.Model):\n name = models.CharField(max_length=255)\n document = CrocoField(thumbnail_field='my_thumbnail')\n my_thumbnail = models.ImageField(upload_to='whatever/')\n\n\nNote that the ``thumbnail_field`` must be a type of `ImageField \n`_.\n\nRender the awesomeness\n----------------------\n\nDocuments\n^^^^^^^^^\n\n::\n\n {{ obj.document.name }}\n\nReturns name of the document.\n\n::\n\n {{ obj.document.size }}\n\nReturns size of the document (in bytes).\n\n::\n\n {{ obj.document.size_human }}\n\nReturns human-readable size of the document (eg. 1.3 MB).\n\n::\n\n {{ obj.document.type }}\n\nReturns type (extension) of the document.\n\n::\n\n {{ obj.document.uuid }}\n\nReturns UUID of the document (note: each Crocodoc document has unique id).\n\nThumbnails\n^^^^^^^^^^\n\n::\n\n {{ obj.document.thumbnail }}\n\nReturns thumbnail as inline image (see `Data URI scheme `_ for more details). See below for how to download a thumbnail.\n\nURLs\n^^^^\n\n::\n\n {{ obj.document.url }}\n\nReturns url of the document so it can be viewed directly.\n\n::\n\n {{ obj.document.content_url }}\n\nReturns url of the document wrapped in `HttpResponse \n`_ object.\n\nBoth ``url`` and ``content_url`` can be extended with `optional parameters `_.\n\n::\n\n {{ obj.document.url|editable:\"true\"|user_id:\"1\"|user_name:\"admin\" }}\n\n``editable`` param allows users to create annotations and comments while viewing the document.\n**Default: false**\n\n``user_id`` and ``user_name`` will be shown in the viewer to attribute annotations and comments to their author. **Required if editable is true**\n\n::\n\n {{ obj.document.url|user_filter:\"1,2,3\" }}\n\nLimits which users' annotations and comments are shown. Possible values are: *all*, *none*, or a comma-separated list of user IDs. **Default: all**\n\n**Note**: ``user_filter`` is a renamed version of Crocodoc's ``filter`` in order to work in Django template system.\n\nFull list of supported `parameters `_.\n\nDownloads\n^^^^^^^^^\n\n::\n\n {{ obj.document.download_document }}\n\nReturns the original document in PDF format.\n\n::\n\n {{ obj.document.download_document|annotated:\"true\" }}\n\nReturns the original document with annotations. **Default: false**\n\n::\n\n {{ obj.document.download_document|user_filter:\"1,2,3\" }}\n\nReturns the original document with annotations limited to given users.\nPossible values are: *all*, *none*, or a comma-separated list of user IDs. **Default: all**\n\n::\n\n {{ obj.document.download_thumbnail }}\n\nReturns a thumbnail of the document's first page in PNG format.\n\n::\n\n {{ obj.document.download_thumbnail|size:\"99x99\" }}\n\nSame as ``download_thumbnail`` with custom dimensions of the thumbnail in the format *{width}x{height}*. Largest dimensions allowed are 300x300. **Default: 100x100**\n\n::\n\n {{ obj.document.download_text }}\n\nReturns the full text from a document.\nNote: This method is available only if your Crocodoc account has text\nextraction enabled.\n\n\n.. image:: https://d2weczhvl823v0.cloudfront.net/mattack108/djcroco/trend.png\n :alt: Bitdeli badge\n :target: https://bitdeli.com/free", "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/mattack108/djcroco/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "djcroco", "package_url": "https://pypi.org/project/djcroco/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/djcroco/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/mattack108/djcroco/" }, "release_url": "https://pypi.org/project/djcroco/0.3.2/", "requires_dist": null, "requires_python": null, "summary": "UNKNOWN", "version": "0.3.2" }, "last_serial": 929627, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "f5e7620697095a02e077dd6ea20a3eef", "sha256": "719b36027a9f8ddc6095c6399cfb7ce7e9d8d95bd2162003f5863f133c97c0a0" }, "downloads": -1, "filename": "djcroco-0.1.tar.gz", "has_sig": false, "md5_digest": "f5e7620697095a02e077dd6ea20a3eef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4901, "upload_time": "2013-04-25T09:59:34", "url": "https://files.pythonhosted.org/packages/05/c3/09faff156138d9200c94505f757bb7d76dc6d07ef798276882decdd485a5/djcroco-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "ee5f8016cb6127aca4eae3a08ccc1a3e", "sha256": "10e79edf64f0831e48473a70cdb68cabd6eb0c0c3a6bc6ff0c5cf0031ecb515b" }, "downloads": -1, "filename": "djcroco-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ee5f8016cb6127aca4eae3a08ccc1a3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4958, "upload_time": "2013-04-25T16:49:08", "url": "https://files.pythonhosted.org/packages/21/c4/6350907a5f6b29755cd292206ed88f465b565f7f264ac9e25e74811aa672/djcroco-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "10b75f49acea59504e10dde49dced1b5", "sha256": "14aa9e3dc16dabcaa3e22232c7e19c9d09984ccd1c33b77f9d9f93eedb2eeae1" }, "downloads": -1, "filename": "djcroco-0.1.2.tar.gz", "has_sig": false, "md5_digest": "10b75f49acea59504e10dde49dced1b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4924, "upload_time": "2013-04-26T06:36:06", "url": "https://files.pythonhosted.org/packages/27/b8/1b963d3d15b093cb0efd90642de4c8dca60f7215eb5785de2459cdc94064/djcroco-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "26762454dd028f29f080047850b079fd", "sha256": "33973ed342553d3c777194a314022450b0ca83faf93386bc113de3fd37864d50" }, "downloads": -1, "filename": "djcroco-0.1.3.tar.gz", "has_sig": false, "md5_digest": "26762454dd028f29f080047850b079fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4957, "upload_time": "2013-04-29T09:50:00", "url": "https://files.pythonhosted.org/packages/fd/19/447b3613cb535992bd3c4ad9de9c5cd6bcf080e5700f73a9181910493c98/djcroco-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "fa57da646e5b158185aedc03db2430e6", "sha256": "39ca2486d5aba438305cd2c58cfbb44debf49f5a5ef145ada2b8ff9baaafef79" }, "downloads": -1, "filename": "djcroco-0.2.0.tar.gz", "has_sig": false, "md5_digest": "fa57da646e5b158185aedc03db2430e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4019, "upload_time": "2013-06-21T13:42:05", "url": "https://files.pythonhosted.org/packages/7f/6f/8d945eae8e66ffcf2ceeb71c2f7dbdc4ad6b0ed78600c69273a03969bd8f/djcroco-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "7a7459f73fd3b853b978e25798ec52d0", "sha256": "ad17c19c4bebe3faf84a617238d011905b520cb03c5408c0288312786b9bc139" }, "downloads": -1, "filename": "djcroco-0.2.1.tar.gz", "has_sig": false, "md5_digest": "7a7459f73fd3b853b978e25798ec52d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4007, "upload_time": "2013-06-21T14:10:22", "url": "https://files.pythonhosted.org/packages/c2/bc/54e5ab0dbba90d37b0c9a43cb35db2c345d92a86f037b5f4563a4781a7f8/djcroco-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "6cc21b256ff6ca3cf8e46a68dcffadfa", "sha256": "c6d82cd18bd22fe53dcdbc90bbce074eac1c4746a84e44035d48a180a7750a20" }, "downloads": -1, "filename": "djcroco-0.2.2.tar.gz", "has_sig": false, "md5_digest": "6cc21b256ff6ca3cf8e46a68dcffadfa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4647, "upload_time": "2013-06-24T14:14:42", "url": "https://files.pythonhosted.org/packages/63/ab/5989aa7566b4ff76f39bf3bf8b6ccff98f8cbcc813079ab9f2bcfbb01bcc/djcroco-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "2a5aa92c235b93d9ed392ae09c87f3cb", "sha256": "c27461a77f496ef9ba8be53b55f9c193b337be44737868239bf74de699946da4" }, "downloads": -1, "filename": "djcroco-0.2.3.tar.gz", "has_sig": false, "md5_digest": "2a5aa92c235b93d9ed392ae09c87f3cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6697, "upload_time": "2013-06-25T11:13:08", "url": "https://files.pythonhosted.org/packages/f3/f7/448998bdd4f17d6e1e72faec0988de733f51cb74babbfc9f0a97d6582117/djcroco-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "3ff8296edb4d43e5b7c070612fef005d", "sha256": "4509717374869166b8d9e4c9a1af588f719a96d0ab16b492f68f07898c4fc55f" }, "downloads": -1, "filename": "djcroco-0.2.4.tar.gz", "has_sig": false, "md5_digest": "3ff8296edb4d43e5b7c070612fef005d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7212, "upload_time": "2013-06-26T06:24:58", "url": "https://files.pythonhosted.org/packages/c4/c5/2eccea8be2ab0465b73d16c9ebdcb188b62f4b56e8c8eb6b38edbe517e5c/djcroco-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "97f113548083b0ed752678882d764ee1", "sha256": "a8c19272571b1bf779c455ab6676604740e149f4872aff7b4b73370c3771183c" }, "downloads": -1, "filename": "djcroco-0.2.5.tar.gz", "has_sig": false, "md5_digest": "97f113548083b0ed752678882d764ee1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7463, "upload_time": "2013-06-28T14:18:20", "url": "https://files.pythonhosted.org/packages/3b/d0/e827e426dde769fddf9f1850e9782639c6b59cb2644d5554d795560a3228/djcroco-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "2ba8ddbb182da3c626949f154a6fa719", "sha256": "f1af314d33d4f604c4354dfa13d4d3ea6bf932503e947e7fa49ba0cc91e07390" }, "downloads": -1, "filename": "djcroco-0.2.6.tar.gz", "has_sig": false, "md5_digest": "2ba8ddbb182da3c626949f154a6fa719", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8871, "upload_time": "2013-07-15T22:51:14", "url": "https://files.pythonhosted.org/packages/5f/53/e1045c1f412713044a8740a6753185ea861538fe01b70a6722b0ce68726f/djcroco-0.2.6.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "b853d5f0c1d9e879a5c9f4a1fb5ee2a6", "sha256": "b288b5a9dadeea32db68990c35d20c65c55b3e96a6d0c094bcc9d5d643ab5927" }, "downloads": -1, "filename": "djcroco-0.3.0.tar.gz", "has_sig": false, "md5_digest": "b853d5f0c1d9e879a5c9f4a1fb5ee2a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9767, "upload_time": "2013-07-21T13:25:22", "url": "https://files.pythonhosted.org/packages/ee/0f/355676acf1c21334d39f41e0ca15029f44dd5f04c6fc16df72b7183ad5e9/djcroco-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "3788cb6e6fc2592a58ffe3774e8e28df", "sha256": "8c47d61af8d63a709822d74acf00e0814eab67dbfdaffeb65375c707afdd82ec" }, "downloads": -1, "filename": "djcroco-0.3.1.tar.gz", "has_sig": false, "md5_digest": "3788cb6e6fc2592a58ffe3774e8e28df", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12023, "upload_time": "2013-08-07T08:55:31", "url": "https://files.pythonhosted.org/packages/47/41/34fba29160525f313726f0fc009e5c88732a846215f6b811b4fe38f9df74/djcroco-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "6ee58214c2051d55fdf8f3435fdddb5a", "sha256": "976e154d5b439c76d13647ae49c430346c945fa9f9f4a55cd8d3ca564e4a6981" }, "downloads": -1, "filename": "djcroco-0.3.2.tar.gz", "has_sig": false, "md5_digest": "6ee58214c2051d55fdf8f3435fdddb5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12141, "upload_time": "2013-11-26T15:09:58", "url": "https://files.pythonhosted.org/packages/b4/97/00ec3693b4b442142b6c1a202b342fe1604ef480c872d2dbe3a1e5753119/djcroco-0.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6ee58214c2051d55fdf8f3435fdddb5a", "sha256": "976e154d5b439c76d13647ae49c430346c945fa9f9f4a55cd8d3ca564e4a6981" }, "downloads": -1, "filename": "djcroco-0.3.2.tar.gz", "has_sig": false, "md5_digest": "6ee58214c2051d55fdf8f3435fdddb5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12141, "upload_time": "2013-11-26T15:09:58", "url": "https://files.pythonhosted.org/packages/b4/97/00ec3693b4b442142b6c1a202b342fe1604ef480c872d2dbe3a1e5753119/djcroco-0.3.2.tar.gz" } ] }