{ "info": { "author": "Morgan Aubert", "author_email": "me@morganaubert.name", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "django-js-routes\n################\n\n**Django-js-routes** is a Django application allowing to expose and perform reverse lookups of\nDjango named URL patterns on the client side.\n\n.. contents:: Table of Contents\n :local:\n\nMain requirements\n=================\n\nPython 3.4+, Django 2.0+.\n\nInstallation\n============\n\nTo install Django-js-routes, please use the pip_ command as follows:\n\n.. code-block:: shell\n\n $ pip install --pre django-js-routes\n\nOnce the package is installed, you'll have to add the application to ``INSTALLED_APPS`` in your\nproject's settings module:\n\n.. code-block:: python\n\n INSTALLED_APPS = (\n # all other apps...\n 'js_routes',\n )\n\nYou can then define which URL patterns or URL namespaces you want to expose to the client side by\nsetting the ``JS_ROUTES_INCLUSION_LIST`` setting. This setting allows to define which URLs should be\nserialized and made available to the client side through the generated and / or exported Javascript\nhelper. This list should contain only URL pattern names or namespaces. Here is an example:\n\n.. code-block:: python\n\n JS_ROUTES_INCLUSION_LIST = [\n 'home',\n 'catalog:product_list',\n 'catalog:product_detail',\n ]\n\nNote that if a namespace is included in this list, all the underlying URLs will be made available to\nthe client side through the generated Javascript helper. Django-js-routes is safe by design in the\nsense that *only* the URLs that you configure in this inclusion list will be publicly exposed on the\nclient side.\n\nOnce the list of URLs to expose is configured, you can add the ``{% js_routes %}`` tag to your base\ntemplate in order to ensure that the Javascript helper is available to you when you need it:\n\n.. code-block:: html\n\n {% load js_routes_tags %}\n \n
\n \n \n \n {% js_routes %}\n \n \n\nUsage\n=====\n\nThe URL patterns you configured through the ``JS_ROUTES_INCLUSION_LIST`` setting can then be\nreversed using the generated ``window.reverseUrl`` function, which can be used pretty much the\n\"same\" way you'd use `reverse