{ "info": { "author": "Incuna & @mlen108", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [], "description": "This repository is dead!\n=========================\n\nThis repository is not maintained anymore, `Crocodoc was acquired by Box.net `_ and also this product was never `easy to work with `_.\n\ndjcroco\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\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.", "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/incuna/django-croco/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-croco", "package_url": "https://pypi.org/project/django-croco/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-croco/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/incuna/django-croco/" }, "release_url": "https://pypi.org/project/django-croco/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "UNKNOWN", "version": "1.0.0" }, "last_serial": 1891415, "releases": { "0.4.0": [ { "comment_text": "", "digests": { "md5": "e065a88dc9569b8dfc5ec023a01f4dee", "sha256": "ddfe9dd623bda29b0294c31f7eed87a95ce78293a6a8ee99c63d659eda002d74" }, "downloads": -1, "filename": "django-croco-0.4.0.tar.gz", "has_sig": false, "md5_digest": "e065a88dc9569b8dfc5ec023a01f4dee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12242, "upload_time": "2015-05-08T10:46:16", "url": "https://files.pythonhosted.org/packages/0c/61/85ff6c86aba5bdb09aeb4b1a3c383073c72758bba056f1ae62383904c05f/django-croco-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "c20e8e34aa4c12ea27f7a33ae61ea01f", "sha256": "a4572516447569431e6e95ce6ca7ce525de854cc6b731e0845ca2343f542161f" }, "downloads": -1, "filename": "django-croco-0.4.1.tar.gz", "has_sig": false, "md5_digest": "c20e8e34aa4c12ea27f7a33ae61ea01f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12270, "upload_time": "2015-05-08T15:24:11", "url": "https://files.pythonhosted.org/packages/0d/e7/2d308620456c133a7e9df7fa867262a5809ac6db5345f7ebe21cf3f0c300/django-croco-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "0d52971ec094075bd2001f9b859b5185", "sha256": "9c50c1eb6e35cf1c45f7148b9b6df8fd7dcf125ae050c471cd625682072d58ce" }, "downloads": -1, "filename": "django-croco-0.4.2.tar.gz", "has_sig": false, "md5_digest": "0d52971ec094075bd2001f9b859b5185", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12210, "upload_time": "2016-01-06T13:38:03", "url": "https://files.pythonhosted.org/packages/8c/24/ea842ad03cb7f07a6d14be3cc93e4540daf9ca65c88e271e31810a368560/django-croco-0.4.2.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "6986c93488ec244af6e7f21477e75959", "sha256": "029d45ef232fb2d2055384393155ad1bbd82e993f7e64345a78483e3b8d1903b" }, "downloads": -1, "filename": "django-croco-1.0.0.tar.gz", "has_sig": false, "md5_digest": "6986c93488ec244af6e7f21477e75959", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13449, "upload_time": "2016-01-06T15:50:29", "url": "https://files.pythonhosted.org/packages/1e/3e/2a267d0f93afe406785e5bae8be2871a6fb41d6c545d51d0769a415c16d8/django-croco-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6986c93488ec244af6e7f21477e75959", "sha256": "029d45ef232fb2d2055384393155ad1bbd82e993f7e64345a78483e3b8d1903b" }, "downloads": -1, "filename": "django-croco-1.0.0.tar.gz", "has_sig": false, "md5_digest": "6986c93488ec244af6e7f21477e75959", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13449, "upload_time": "2016-01-06T15:50:29", "url": "https://files.pythonhosted.org/packages/1e/3e/2a267d0f93afe406785e5bae8be2871a6fb41d6c545d51d0769a415c16d8/django-croco-1.0.0.tar.gz" } ] }