{ "info": { "author": "Raffaele Salmaso", "author_email": "raffele@salmaso.org", "bugtrack_url": null, "classifiers": [ "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 2.0", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "# django-rest-caller\nSimple django templatetag for calling an urlconf view endpoint.\n\n## Limitations\n\n* it works only for GET methods\n* it doesn't handle request without a body\n* it doen't play nice with login required views (it assumes that the caller handles everything it is required to access the endpoint)\n* it assumes that the endpoint returns a json\n\n## Installation\n\nInstall with pip\n\n```console\n $ python3 -m pip install django-rest-caller\n```\n\nAdd `caller.apps.CallerConfig` to `INSTALLED_APPS`\n\n```python\n INSTALLED_APPS = [\n ...\n 'caller.apps.CallerConfig',\n ...\n ]\n```\n\n## Usage\n\n### call\n\nIn your template load the templatetag\n\n```html+django\n {% load caller_tags %}\n```\n\nand use the `call` tag as\n```html+django\n {% call 'urlconf' arg1=42 arg2='X' with param1='1' param2='2' as 'object_name' %}\n```\nor\n```html+django\n {% call 'urlconf' 42 'X' with param1='1' param2='2' as 'object_name' %}\n```\n\n* `'urlconf' arg1=42 arg2='X'` this is the usual {% url %} parameters (remember: use args parameter list or kwargs parameters, not both)\n* `param1='1' param2='2'` these parameters will be converted to GET querystring\n* `as 'object_name'` store the called object into object_name object. It can be a string or a variable name.\n\nso the called url is equivalent to\n```html+django\n {% url 'urlconf' arg1=42 arg2='X' %}?param1=1¶m2=2\n```\n\nThe `call` will inject the result json object into the template context, so you can\n\n* use as context object\n\n```html+django\n {% load caller_tags %}\n\n {% call 'api:blog-list' as 'posts' %}\n {% for post in posts %}\n
\n

{{ post.title }}

\n

{{ post.body }}

\n
\n {% endfor %}\n```\n\n* feeding to json tag\n\n```html+django\n {% load caller_tags %}\n\n {% call 'api:blog-list' as 'posts' %}\n {{ posts|json_script:\"posts-data\" }}\n \n```\n\n### json_script\n\nThis tag will backport the django >= 2.1 [`json_script`](https://docs.djangoproject.com/en/2.1/ref/templates/builtins/#json-script) filter,\nwhich safely outputs a Python object as JSON, wrapped in a `\n```\n\nand can be retrieved with\n\n```javascript\n function get_json(name) {\n var el = document.getElementById(name);\n return JSON.parse(el.textContent || el.innerText);\n }\n var data = get_json(\"hello-data\");\n console.log(data);\n```\n\n## Changes\n\n### 0.2.1\n\n* fix VERSION import error\n\n### 0.2.0\n\n* extract generic code from templatetag\n\n### 0.1.5\n\n* proper url unquote arg parameters\n* can use templatefilters in templatetag parameters\n\n### 0.1.4\n\n* show raised exception in called view instead of a generic one\n\n### 0.1.3\n\n* always require `as 'varname'`\n* be able to use args or kwargs for urlconf as documented\n* update documentation\n\n### 0.1.1 - 0.1.2\n\n* update documentation\n\n### 0.1.0\n\n* initial release\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://bitbucket.org/rsalmaso/django-rest-caller", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-rest-caller", "package_url": "https://pypi.org/project/django-rest-caller/", "platform": "", "project_url": "https://pypi.org/project/django-rest-caller/", "project_urls": { "Homepage": "https://bitbucket.org/rsalmaso/django-rest-caller" }, "release_url": "https://pypi.org/project/django-rest-caller/0.2.1/", "requires_dist": [ "django" ], "requires_python": ">=3.4", "summary": "templatetag to call an urlconf and store its payload into the template context", "version": "0.2.1" }, "last_serial": 4627493, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "eb820d2d6507d5a2acd7b16e01683324", "sha256": "6c6d2977f245a6d2f38e50f51fb560dcc4e9eca3751c8ddd95bb58fa968417ab" }, "downloads": -1, "filename": "django_rest_caller-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "eb820d2d6507d5a2acd7b16e01683324", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 26602, "upload_time": "2018-06-21T11:42:58", "url": "https://files.pythonhosted.org/packages/6f/a1/eeb6a419cdd29f2ef631e135c43efe3d4890a3256c4c4ee224f2447b17f7/django_rest_caller-0.1-py3-none-any.whl" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "24577d725ba41dad5b9fa244e61682cd", "sha256": "27f92c85855bbf753d28ca704fedccbf67e09f6549ddc48c50830b3068147319" }, "downloads": -1, "filename": "django_rest_caller-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "24577d725ba41dad5b9fa244e61682cd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 26793, "upload_time": "2018-06-21T13:42:29", "url": "https://files.pythonhosted.org/packages/67/a1/d95e912a3e7c7f060c73f3c1adfce3c6e85078a253d4b774fbb240699d17/django_rest_caller-0.1.1-py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "834c5a4a95fdfcf1ac762df13dd98da6", "sha256": "065d8d96d964e8e88aa301d4a613422360f39194748939fc53ad3fd43cfd3ad8" }, "downloads": -1, "filename": "django_rest_caller-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "834c5a4a95fdfcf1ac762df13dd98da6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 24709, "upload_time": "2018-06-21T23:15:58", "url": "https://files.pythonhosted.org/packages/eb/79/ae8f5a1409e53e49322cda732df35f32b3d32b160220b09c317b3daf9aef/django_rest_caller-0.1.2-py3-none-any.whl" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "70a7c103e3f91d87e35be7df97decdc5", "sha256": "0806e464b3cebfb6daf3013eaf748109fdb43cc27959b2cafe55f29f4d4c4033" }, "downloads": -1, "filename": "django_rest_caller-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "70a7c103e3f91d87e35be7df97decdc5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 25273, "upload_time": "2018-06-22T14:53:56", "url": "https://files.pythonhosted.org/packages/4c/e0/eef5a6146c45705ae5580c57898ff3010d73ee9bc93ac2ddbdafedab4979/django_rest_caller-0.1.3-py3-none-any.whl" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "83d96d2bbccb743cda6a91966a2b9294", "sha256": "d7bc2d8e2a5a46faa07eaad9c47b670d4ff1fddb7e46242b24e4961f08824254" }, "downloads": -1, "filename": "django_rest_caller-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "83d96d2bbccb743cda6a91966a2b9294", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 25628, "upload_time": "2018-07-22T15:26:04", "url": "https://files.pythonhosted.org/packages/62/26/d15ef5e4c43abc36409043f13219cbeb71f446a83d8c8fc8daed7e51c3cf/django_rest_caller-0.1.4-py3-none-any.whl" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "451569d3eac1d289274e0ff995a71340", "sha256": "ac9a5b0d72c08f0851e1f70cab5fe18ea876dc1a2be89f64e65b08c54352982c" }, "downloads": -1, "filename": "django_rest_caller-0.1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "451569d3eac1d289274e0ff995a71340", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 25813, "upload_time": "2018-07-22T15:26:37", "url": "https://files.pythonhosted.org/packages/af/1b/2c3a823e9b59d944a514af1e5f1306e1435e38196c014a1923d215f549ef/django_rest_caller-0.1.5-py3-none-any.whl" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "d122202ecd620d4ae7e81973a4bcc04f", "sha256": "de518469b1d4f3520415573594baa4476644b512a870fa1707f479d9099bb734" }, "downloads": -1, "filename": "django_rest_caller-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d122202ecd620d4ae7e81973a4bcc04f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 26794, "upload_time": "2018-07-22T15:27:06", "url": "https://files.pythonhosted.org/packages/81/e1/9cbaf63f7f7924ffe60862e10a88556fa1b12d63ecff2a20629ab557cdd4/django_rest_caller-0.2-py3-none-any.whl" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "9ac07edbc29fb6f4c60b7030c10276ee", "sha256": "976706ccddfc12688621b92c9637895007dd8d0e071fc726cccd0a1836717b3d" }, "downloads": -1, "filename": "django_rest_caller-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9ac07edbc29fb6f4c60b7030c10276ee", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 27932, "upload_time": "2018-12-22T09:15:47", "url": "https://files.pythonhosted.org/packages/46/43/fa6c790f3b6bb4399967e7fdde48a3c0bb793ff473b4597eeb07fad93a49/django_rest_caller-0.2.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9ac07edbc29fb6f4c60b7030c10276ee", "sha256": "976706ccddfc12688621b92c9637895007dd8d0e071fc726cccd0a1836717b3d" }, "downloads": -1, "filename": "django_rest_caller-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9ac07edbc29fb6f4c60b7030c10276ee", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 27932, "upload_time": "2018-12-22T09:15:47", "url": "https://files.pythonhosted.org/packages/46/43/fa6c790f3b6bb4399967e7fdde48a3c0bb793ff473b4597eeb07fad93a49/django_rest_caller-0.2.1-py3-none-any.whl" } ] }