{ "info": { "author": "Maykin Media, Robin Ramael, Sergei Maertens", "author_email": "robin.ramael@maykinmedia.nl,sergei@maykinmedia.nl", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.9", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "# Django-bureaucracy\n\nDjango-Bureaucracy is a small wrapper around the [bureacracy](https://bitbucket.org/maykinmedia/bureaucracy)\npackage that can be used to generate word and pdf documents from .docx-templates \nusing Mailmerge fields.\n\n\n## Installation:\n\n```\npip install --process-dependency-links -e git+https://bitbucket.org/maykinmedia/django-bureaucracy.git#egg=django_bureaucracy-0.1\n```\n\n(Note that setuptools is annoying and that this doesn't work without the\n`--process-dependency-links` flag which is deprecated. Have fun figuring out\nhow to do this when it's removed.)\n\n... and then add `django_bureaucracy` to `INSTALLED_APPS`.\n\n## Usage \n\n### Example\n\n\n```python\n\nfrom django_bureaucracy.models import Document\n\n# The document model is used to store a template and render documents from a context:\n\ndoc = Document(\n template_file=File(open('sample.docx')),\n type='tps_report',\n validate_fields=True,\n)\n\ndoc.save()\n\n\ncontext = {\n 'table': Table(data=[['this is the first cell of the first row', 'this is the second cell of the first row'],\n ['the second row', 'etc'], \n ['etc', 'etc']], \n headers=['header 1', 'header 2']),\n 'image': Image('pigeon.jpg')\n 'html': HTML(\"

This is a header from html. And the styling works! Right?

bold-notbold

\")\n 'text': 'some text',\n}\n\n# return bytes of the document generated from the template file and the context\ndoc_bytes = doc.render(context) \n\n# idem but for pdf bytes:\npdf_bytes = doc.render(context, format='pdf')\n\n\n# save to a file:\ndoc.render_to_file(context, '/path/to/file') # docx\ndoc.render_to_file(context, '/path/to/file', format='pdf') # pdf\n```\n\n\n### Rendering to HTTPResponse with the correct mimetype.\n\n```python\n\nfrom django_bureaucracy.shortcuts import render_to_download\n\ndef view(request)\n\n # (...)\n \n resp = render_to_download(Document.objects.get(...), context, format='docx')\n # or... \n resp = render_to_download(DocxTemplate(...), context, format='pdf')\n # or ... \n resp = render_to_download(DocxTemplate('/path/to/file', context)\n # or ...\n resp = render_to_download(DocxTemplate(file_like_object, context)\n \n return resp\n\n```\n\n\n### Admin Integration\n\nWhen the package is installed, `Document`-objects can be created in the \nadmin. When the `validate_fields` box is checked, the model's `clean` method \nwill check the `DOCX_TEMPLATE_VARS` setting to see whether the fields in\nthe template file and the document type match the ones provided in the setting and \nraise a `ValidationError` if this is not the case.\n\n\n```python\n\n# in settings.py\n\nDOCX_TEMPLATE_VARS = {\n 'tps_report': ['image', 'table', 'html', 'text'],\n 'letter': ['graph']\n}\n```", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "django-bureaucracy", "package_url": "https://pypi.org/project/django-bureaucracy/", "platform": "", "project_url": "https://pypi.org/project/django-bureaucracy/", "project_urls": null, "release_url": "https://pypi.org/project/django-bureaucracy/0.4.2/", "requires_dist": null, "requires_python": "", "summary": "Django layer on top of the bureaucracy package", "version": "0.4.2" }, "last_serial": 3545859, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "e6e4e193ec3e487434c787daad01242a", "sha256": "cdd42ae06a27968b4c5c53535b0a07ef6dc8b75aeefb42321103b75e592a11a9" }, "downloads": -1, "filename": "django_bureaucracy-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e6e4e193ec3e487434c787daad01242a", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 8279, "upload_time": "2017-03-17T16:15:06", "url": "https://files.pythonhosted.org/packages/9b/aa/a5ebd7627c07a50a1cbafb94c5150974920a39196a52b461a0f79a2ec4b4/django_bureaucracy-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3c31dfb457eec89d112916b681fc1fc5", "sha256": "c641027cd3203d1a373cdfe3b0c1890e430760fe3206dc19df1db99460baebfd" }, "downloads": -1, "filename": "django-bureaucracy-0.2.tar.gz", "has_sig": false, "md5_digest": "3c31dfb457eec89d112916b681fc1fc5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5003, "upload_time": "2017-03-17T16:15:02", "url": "https://files.pythonhosted.org/packages/7d/ad/c3888931f70f9f8929bdaa30f698dd7d6818b990fce2750a459bf239ca2a/django-bureaucracy-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "bcb31e136223cc9bd61a321ab6258a20", "sha256": "2ae7e59f8d0cdaad7570dc65cc395cb816f63e16e991edfbb01fe7b6ce95279f" }, "downloads": -1, "filename": "django_bureaucracy-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "bcb31e136223cc9bd61a321ab6258a20", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 8485, "upload_time": "2017-03-22T09:52:41", "url": "https://files.pythonhosted.org/packages/db/2e/4e9c87caabae7cec4702be9b983a81b930933b6438d11821ea86fd447942/django_bureaucracy-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2cd13ba1e4dbfa5f68b02f750059d268", "sha256": "91d90d7b923bad4c8788bab21698b64b421763e571a3a131e60a9105292f9588" }, "downloads": -1, "filename": "django-bureaucracy-0.2.1.tar.gz", "has_sig": false, "md5_digest": "2cd13ba1e4dbfa5f68b02f750059d268", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5181, "upload_time": "2017-03-22T09:52:39", "url": "https://files.pythonhosted.org/packages/bb/9f/2750e2b806a11be51f3cf23c0180411920cd89b36c67acd9d57637dea6e3/django-bureaucracy-0.2.1.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "99239fca59becffcbfcbc17bd4f74710", "sha256": "dff344aa8fd5ebf1876698428f9a36cb7157d73b977f58a77298d1356681d243" }, "downloads": -1, "filename": "django_bureaucracy-0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "99239fca59becffcbfcbc17bd4f74710", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 8685, "upload_time": "2017-03-24T11:34:35", "url": "https://files.pythonhosted.org/packages/7c/03/6e24ec3e1f86404a976a8671d31c5f5d5aa76cc16e9895922927c885b205/django_bureaucracy-0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "831dc4266977ad1ba19527034acfdc6e", "sha256": "e3f8e40c04a8abcf2a849faa7dc6bf208108e98c2dfb3ab25d95c36dcbfbd042" }, "downloads": -1, "filename": "django-bureaucracy-0.3.tar.gz", "has_sig": false, "md5_digest": "831dc4266977ad1ba19527034acfdc6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5400, "upload_time": "2017-03-24T11:34:33", "url": "https://files.pythonhosted.org/packages/be/3d/300bac61a570a04a5c2321c168c706dcaf7a64abcd9afa058033f54a4ee8/django-bureaucracy-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "8a5a6b58f90eecd64f18e6a8acb3c387", "sha256": "f2c529fc6a120376e8c06804cd9f4cd0d8467e4f6bcf0f77e5d73071e30ba004" }, "downloads": -1, "filename": "django_bureaucracy-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8a5a6b58f90eecd64f18e6a8acb3c387", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 8733, "upload_time": "2017-03-29T07:22:52", "url": "https://files.pythonhosted.org/packages/c4/46/04c57d4f61e06b51331ffd01a37384aadb9bbd11a90aea1483d27f2823a4/django_bureaucracy-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7faaf0686099167c0a3fbba3a16729be", "sha256": "abf83cf991e2a0340b5b3ebb1934c183a57c6274f6a2d41940610a2985620e5e" }, "downloads": -1, "filename": "django-bureaucracy-0.3.1.tar.gz", "has_sig": false, "md5_digest": "7faaf0686099167c0a3fbba3a16729be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5436, "upload_time": "2017-03-29T07:22:51", "url": "https://files.pythonhosted.org/packages/19/ba/7f6d4b4887535a6df1fa6a26b095057365cee5cda8ad98ddd020263d7e26/django-bureaucracy-0.3.1.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "4e81fad08b1a86c4272be4b094dad044", "sha256": "0b471311ea052779af71e1693187b7d2e14d53c3f02c52be4cdbced7978be514" }, "downloads": -1, "filename": "django_bureaucracy-0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "4e81fad08b1a86c4272be4b094dad044", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 8780, "upload_time": "2017-03-31T15:57:37", "url": "https://files.pythonhosted.org/packages/01/80/aa74709bacd7996a6807a6edf612d2a6c04f58f43bd08210e83c3c11ae0a/django_bureaucracy-0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3b11b7dd34b1239efdb33ee55bfa0097", "sha256": "17173c97090d0112390d60a2254f16c76b2bed46250bccf22825c33657e11666" }, "downloads": -1, "filename": "django-bureaucracy-0.4.tar.gz", "has_sig": false, "md5_digest": "3b11b7dd34b1239efdb33ee55bfa0097", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5501, "upload_time": "2017-03-31T15:57:35", "url": "https://files.pythonhosted.org/packages/be/b6/8421d874a4a2f2b43623507e69e64115ba2ea330c60b8843945f83fd83b0/django-bureaucracy-0.4.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "99ddf1c3d8223170b72dd89bc981e7e3", "sha256": "f0fba66cf9a8a39b8cba2877e619acfbcce8bc0c870b52ea0abd53ab585bff8c" }, "downloads": -1, "filename": "django_bureaucracy-0.4.1-py3-none-any.whl", "has_sig": false, "md5_digest": "99ddf1c3d8223170b72dd89bc981e7e3", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 8907, "upload_time": "2017-04-28T13:47:22", "url": "https://files.pythonhosted.org/packages/a5/c5/6d893dd854f3255898abb66b626e234fb361dd4d743666de7aa695406a94/django_bureaucracy-0.4.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "450ce94ed8a76c87b3d00b9c2ec91544", "sha256": "daa46b0155b36f475013e7a17ce73cf39349105207d18be0e06e23e3bd418312" }, "downloads": -1, "filename": "django-bureaucracy-0.4.1.tar.gz", "has_sig": false, "md5_digest": "450ce94ed8a76c87b3d00b9c2ec91544", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5605, "upload_time": "2017-04-28T13:47:20", "url": "https://files.pythonhosted.org/packages/a1/ec/4bf25efde9e8750c722a3e01a4b2280d857badb2597280bfe83d20d7b36c/django-bureaucracy-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "9cabe868c76031baab78c59560422b97", "sha256": "37b194b3c11c2a519f28401a5ce5fe12e3f612aea94655d635f3fdb2d3527ac0" }, "downloads": -1, "filename": "django_bureaucracy-0.4.2-py3-none-any.whl", "has_sig": false, "md5_digest": "9cabe868c76031baab78c59560422b97", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 11260, "upload_time": "2018-02-02T15:10:49", "url": "https://files.pythonhosted.org/packages/0f/13/564b74c7f7437d1df316f4f94b28654a2d5589496eba7668446817c04654/django_bureaucracy-0.4.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "973b58a5e00ce6f2cd13e376f94b1fad", "sha256": "d508e71d7821acb1b162291f24f1c3f9aac73b7af060d00f33159c7e1f979766" }, "downloads": -1, "filename": "django-bureaucracy-0.4.2.tar.gz", "has_sig": false, "md5_digest": "973b58a5e00ce6f2cd13e376f94b1fad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7557, "upload_time": "2018-02-02T15:10:45", "url": "https://files.pythonhosted.org/packages/4f/52/8691c2834a734150fa928fd87c64fe7d498b419ad7f86c41b69c4a8bb837/django-bureaucracy-0.4.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9cabe868c76031baab78c59560422b97", "sha256": "37b194b3c11c2a519f28401a5ce5fe12e3f612aea94655d635f3fdb2d3527ac0" }, "downloads": -1, "filename": "django_bureaucracy-0.4.2-py3-none-any.whl", "has_sig": false, "md5_digest": "9cabe868c76031baab78c59560422b97", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 11260, "upload_time": "2018-02-02T15:10:49", "url": "https://files.pythonhosted.org/packages/0f/13/564b74c7f7437d1df316f4f94b28654a2d5589496eba7668446817c04654/django_bureaucracy-0.4.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "973b58a5e00ce6f2cd13e376f94b1fad", "sha256": "d508e71d7821acb1b162291f24f1c3f9aac73b7af060d00f33159c7e1f979766" }, "downloads": -1, "filename": "django-bureaucracy-0.4.2.tar.gz", "has_sig": false, "md5_digest": "973b58a5e00ce6f2cd13e376f94b1fad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7557, "upload_time": "2018-02-02T15:10:45", "url": "https://files.pythonhosted.org/packages/4f/52/8691c2834a734150fa928fd87c64fe7d498b419ad7f86c41b69c4a8bb837/django-bureaucracy-0.4.2.tar.gz" } ] }