{ "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
{{ post.body }}
\n