{ "info": { "author": "Philippe Docourt", "author_email": "contact@dprog.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Django", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8" ], "description": "[![Latest PyPI version](https://badge.fury.io/py/django-string-renderer.svg)](https://badge.fury.io/py/string-renderer)\n[![Build Status](https://travis-ci.org/dprog-philippe-docourt/django-string-renderer.svg?branch=master)](https://travis-ci.org/dprog-philippe-docourt/django-string-renderer)\n\n# django-string-renderer\nA thin wrapper around the Django templating system to render any string as a template. It provides an easy way to render any user inputted string as a regular django template.\n\n## Requirements\nThis wrapper uses no models and requires no other settings than a `django` engine in the `TEMPLATES` setting where the app is used.\n\nThis package uses type annotations and `mypy` to check those annotations.\n\nThis package is only tested against Python >= 3.5 and Django >= 1.11.\n\n## Installation\n\n### Binary Package from PyPi\nIn order to use this app in a Django project, the simplest way is to install it from [PyPi](https://pypi.python.org/pypi/django-string-renderer):\n```bash\npip install django-string-renderer\n```\n\n### From the Source Code\nIn order to modify or test this app you may want to install it from the source code.\n\nClone the [GitHub repository](https://github.com/dprog-philippe-docourt/django-string-renderer) and then run:\n```bash\npip install -r requirements.txt -r requirements-dev.txt\n```\n\n## Usage\nStart by adding `stringrenderer` to your `INSTALLED_APPS` setting like this:\n```python\nINSTALLED_APPS = (\n ...,\n 'stringrenderer',\n)\n```\nThen use the `StringTemplateRenderer` class to build a Django template instance from a string et render the string with the context of your choice:\n```python\nimport stringrenderer\n\ntemplate_string = \"Hello {{ recipient.first_name }} {{ recipient.last_name }}!\"\nrenderer = StringTemplateRenderer(template_string)\n\nrendered_content = renderer.render_template(context=dict(recipient=recipient_1), request=request)\nrendered_content = renderer.render_template(context=dict(recipient=recipient_2), request=None)\n```\n\nWhen the first rendering request occurs on a given `StringTemplateRenderer` instance, a `Template` object is built from the string passed to `__init__()`, and cached for the next rendering operations with other contexts.\n\nYou may check the template syntax of a string like this:\n```python\nimport stringrenderer\n\ntemplate_string = \"Hello {{ recipient.first_name }} {{ recipient.last_name }}!\"\nis_valid, syntax_error = check_template_syntax(template_string)\n```\n\n## Testing\nGet the source code from [GitHub](https://github.com/dprog-philippe-docourt/django-string-renderer), follow the [installation instructions](#from-the-source-code) above, and run the following command:\n```bash\npython runtests.py\n```\nThis will run the test suite with the locally installed version of Python and Django.\n\n## Projects Using this App\nThis app is used in the following projects:\n* [MyGym Web](https://mygym-web.ch/): a web platform for managing sports clubs. django-string-renderer is used to render the messages and emails addressed to the members.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dprog-philippe-docourt/django-string-renderer", "keywords": "templating django", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-string-renderer", "package_url": "https://pypi.org/project/django-string-renderer/", "platform": "", "project_url": "https://pypi.org/project/django-string-renderer/", "project_urls": { "Homepage": "https://github.com/dprog-philippe-docourt/django-string-renderer" }, "release_url": "https://pypi.org/project/django-string-renderer/0.1.3/", "requires_dist": [ "django", "djangocodemirror" ], "requires_python": ">=3.5", "summary": "A thin wrapper around the Django templating system to render any string as a template. It provides an easy way to render any user inputted string as a regular django template.", "version": "0.1.3" }, "last_serial": 5920369, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "8f32712117495166f583772b24d5b90d", "sha256": "d2ffc87b1d6e89db962aae7572b35df7e6cca2b4a400f9b481527e37ee6f8c4f" }, "downloads": -1, "filename": "django_string_renderer-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8f32712117495166f583772b24d5b90d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 5930, "upload_time": "2019-08-13T21:45:15", "url": "https://files.pythonhosted.org/packages/42/f0/b698feb51f24177f052e1bba077ed909f4ae280c29f98d5fe192175182be/django_string_renderer-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c0a21af843935e48a2b4882969f33726", "sha256": "b312a0de91e15b4743000bd641fad624cdc667ae5601e9da3e7702eb86e53db4" }, "downloads": -1, "filename": "django-string-renderer-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c0a21af843935e48a2b4882969f33726", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 4844, "upload_time": "2019-08-13T21:45:17", "url": "https://files.pythonhosted.org/packages/d8/ed/78f40ce009a2583b0aed385c1817c311fc67312ffb6d0408f0ae62db92ae/django-string-renderer-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "c66caf975c7b57aca7547b47cc80f76b", "sha256": "b9933685091cca72c918e845d7da6a869596420146c7d01d11bc68d599f1f446" }, "downloads": -1, "filename": "django_string_renderer-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "c66caf975c7b57aca7547b47cc80f76b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 6547, "upload_time": "2019-08-13T22:32:54", "url": "https://files.pythonhosted.org/packages/66/a6/3e63b035b7d799785b6bb59a7a1b83c7089a5369621dc4d10f2e48f425fd/django_string_renderer-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bdf846d2e34e07f4c833f1d51d9224db", "sha256": "09d8f8b9ab055be70be9ea77ac9d7db5bd9437fdf4c09b026a5f4f204c81f8bc" }, "downloads": -1, "filename": "django-string-renderer-0.1.2.tar.gz", "has_sig": false, "md5_digest": "bdf846d2e34e07f4c833f1d51d9224db", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 5548, "upload_time": "2019-08-13T22:32:55", "url": "https://files.pythonhosted.org/packages/f1/79/1de9935dd5e7991ea8702dc15e860e31cb8ee3b306a121f8dbc74a9ffadd/django-string-renderer-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "ae7ae60232b86ccc19f9744803e38df8", "sha256": "482869de4cd4d9bd1bbf517b37a63b465d6598fd9c4d0d21561eda6decb62c9d" }, "downloads": -1, "filename": "django_string_renderer-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "ae7ae60232b86ccc19f9744803e38df8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 6678, "upload_time": "2019-10-02T20:32:30", "url": "https://files.pythonhosted.org/packages/cd/d6/3b18950b6ccbe1df356b5bab2174fbfdc9a845a9382913f9c5f087f4e659/django_string_renderer-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8d658774470de4645a21aecdded42100", "sha256": "a6668016d71589cc11034f01afa8e55d27ca2c27f0611c695e7adfa46eb4d124" }, "downloads": -1, "filename": "django-string-renderer-0.1.3.tar.gz", "has_sig": false, "md5_digest": "8d658774470de4645a21aecdded42100", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 5691, "upload_time": "2019-10-02T20:32:31", "url": "https://files.pythonhosted.org/packages/91/c4/167f3e8dfc031cffca4434c2fd880a58bfd6f6aca47851d8a76827e0f098/django-string-renderer-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ae7ae60232b86ccc19f9744803e38df8", "sha256": "482869de4cd4d9bd1bbf517b37a63b465d6598fd9c4d0d21561eda6decb62c9d" }, "downloads": -1, "filename": "django_string_renderer-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "ae7ae60232b86ccc19f9744803e38df8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 6678, "upload_time": "2019-10-02T20:32:30", "url": "https://files.pythonhosted.org/packages/cd/d6/3b18950b6ccbe1df356b5bab2174fbfdc9a845a9382913f9c5f087f4e659/django_string_renderer-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8d658774470de4645a21aecdded42100", "sha256": "a6668016d71589cc11034f01afa8e55d27ca2c27f0611c695e7adfa46eb4d124" }, "downloads": -1, "filename": "django-string-renderer-0.1.3.tar.gz", "has_sig": false, "md5_digest": "8d658774470de4645a21aecdded42100", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 5691, "upload_time": "2019-10-02T20:32:31", "url": "https://files.pythonhosted.org/packages/91/c4/167f3e8dfc031cffca4434c2fd880a58bfd6f6aca47851d8a76827e0f098/django-string-renderer-0.1.3.tar.gz" } ] }