{ "info": { "author": "Bernhard Janetzki", "author_email": "boerni@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Django", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "=================\nDjango JS Reverse\n=================\n\n.. image:: https://img.shields.io/pypi/v/django-js-reverse.svg\n :target: https://pypi.python.org/pypi/django-js-reverse/\n\n.. image:: https://img.shields.io/travis/ierror/django-js-reverse/master.svg\n :target: https://travis-ci.org/ierror/django-js-reverse\n\n.. image:: https://img.shields.io/coveralls/ierror/django-js-reverse/master.svg\n :alt: Coverage Status\n :target: https://coveralls.io/r/ierror/django-js-reverse?branch=master\n\n.. image:: https://img.shields.io/github/license/ierror/django-js-reverse.svg\n :target: https://raw.githubusercontent.com/ierror/django-js-reverse/develop/LICENSE\n\n.. image:: https://img.shields.io/pypi/wheel/django-js-reverse.svg\n\n\n**Javascript url handling for Django that doesn\u2019t hurt.**\n\n\nOverview\n--------\n\nDjango JS Reverse is a small django app that makes url handling of\n`named urls `_ in javascript easy and non-annoying..\n\nFor example you can retrieve a named url:\n\nurls.py:\n\n::\n\n url(r'^/betterliving/(?P[-\\w]+)/(?P\\d+)/$', 'get_house', name='betterliving_get_house'),\n\nin javascript like:\n\n::\n\n Urls.betterliving_get_house('house', 12)\n\nResult:\n\n::\n\n /betterliving/house/12/\n\n\n\nChangelog\n_________\n\n0.9.0\n New: Support for Python 3.7\n\n0.8.2\n Fix: A bug fix in Django 2.0.6 has broken django-js-reverse `#65 `_\n Thank you `kavdev `_\n\n0.8.1\n Fix: The tests folder of the `#53 `__ was still present in the build. => Added cleanup to the release make command.\n\n0.8.0\n New: Support for Django 2.0: `#58 `_\n Thank you `wlonk `_\n\n Fix: `#53 `__ - Don't install the tests folder as a separate folder. Moved inside the django_js_reverse namespace.\n\n0.7.3\n New: Support for Django 1.10\n\n Chg: Renamed \"production\" branch to \"master\"\n\n Fix: `#48 `_ - \"Change False to 'window' in global object name in README.\"\n Thank you `karamanolev `_\n\n Fix: `PR #45 `_ - \"Fix: collectstatic_js_reverse usage message\"\n Thank you `ghedsouza `_\n\n Fix: `PR #44 `_ - \"Remove duplicate _get_url call\"\n Thank you `razh `_\n\n\n`Full changelog `_\n\n\nRequirements\n------------\n\n+----------------+------------------------------------------+\n| Python version | Django versions |\n+================+==========================================+\n| 3.7 | 2.0, 1.11, 1.10, 1.9, 1.8 |\n+----------------+------------------------------------------+\n| 3.6 | 2.0, 1.11, 1.10, 1.9, 1.8 |\n+----------------+------------------------------------------+\n| 3.5 | 2.0, 1.11, 1.10, 1.9, 1.8 |\n+----------------+------------------------------------------+\n| 3.4 | 2.0, 1.11, 1.10, 1.9, 1.8, 1.7, 1.6, 1.5 |\n+----------------+------------------------------------------+\n| 2.7 | 1.11, 1.10, 1.9, 1.8, 1.7, 1.6, 1.5 |\n+----------------+------------------------------------------+\n\n\nInstallation\n------------\n\nInstall using ``pip`` \u2026\n\n::\n\n pip install django-js-reverse\n\n\u2026 or clone the project from github.\n\n::\n\n git clone https://github.com/ierror/django-js-reverse.git\n\nAdd ``'django_js_reverse'`` to your ``INSTALLED_APPS`` setting.\n\n::\n\n INSTALLED_APPS = (\n ...\n 'django_js_reverse',\n )\n\n\nUsage with webpack\n------------------\n\nInstall using ``npm``\n\n::\n\n npm install --save django-js-reverse\n\n\nInclude none-cached view \u2026\n\n::\n\n urlpatterns = patterns('',\n url(r'^jsreverse.json$', 'django_js_reverse.views.urls_json', name='js_reverse'),\n )\n\n\u2026 or a cached one that delivers the urls JSON\n\n::\n\n from django_js_reverse import views\n urlpatterns = patterns('',\n url(r'^jsreverse.json$', cache_page(3600)(views.urls_json), name='js_reverse'),\n )\n\nInclude JavaScript in your bundle:\n\n::\n\n // utils/djangoReverse.mjs\n import _ from 'lodash/fp';\n import djangoJsReverse from 'django-js-reverse';\n\n export default _.once(\n async () => {\n const res = await fetch('/jsreverse.json');\n const data = await res.json():\n return djangoJsReverse(data);\n }\n )\n\n::\n\n // somePlace.mjs\n import djangoReverse from './utils/djangoReverse';\n\n (async () => {\n const urls = await djangoReverse;\n const url = urls.someViewName('some-arg');\n ...\n })();\n\n\nUsage as static file\n--------------------\n\nFirst generate static file by\n\n::\n\n ./manage.py collectstatic_js_reverse\n\nIf you change some urls or add an app and want to update the reverse.js file,\nrun the command again.\n\nAfter this add the file to your template\n\n::\n\n \n\n\nUsage with views\n----------------\n\nInclude none-cached view \u2026\n\n::\n\n urlpatterns = patterns('',\n url(r'^jsreverse/$', 'django_js_reverse.views.urls_js', name='js_reverse'),\n )\n\n\u2026 or a cached one that delivers the urls javascript\n\n::\n\n from django_js_reverse.views import urls_js\n urlpatterns = patterns('',\n url(r'^jsreverse/$', cache_page(3600)(urls_js), name='js_reverse'),\n )\n\nInclude javascript in your template\n\n::\n\n \n\nor, if you are using Django > 1.5\n\n::\n\n \n\n\nUsage as template tag\n_____________________\n\n\n::\n\n {% load js_reverse %}\n\n \n\n\nUse the urls in javascript\n--------------------------\n\nIf your url names are valid javascript identifiers ([$A-Z\\_][-Z\\_$]\\*)i\nyou can access them by the Dot notation:\n\n::\n\n Urls.betterliving_get_house('house', 12)\n\nIf the named url contains invalid identifiers use the Square bracket\nnotation instead:\n\n::\n\n Urls['betterliving-get-house']('house', 12)\n Urls['namespace:betterliving-get-house']('house', 12)\n\nYou can also pass javascript objects to match keyword aguments like the\nexamples bellow:\n\n::\n\n Urls['betterliving-get-house']({ category_slug: 'house', entry_pk: 12 })\n Urls['namespace:betterliving-get-house']({ category_slug: 'house', entry_pk: 12 })\n\nOptions\n-------\n\nOptionally, you can overwrite the default javascript variable \u2018Urls\u2019 used\nto access the named urls by django setting\n\n::\n\n JS_REVERSE_JS_VAR_NAME = 'Urls'\n\nOptionally, you can change the name of the global object the javascript variable\nused to access the named urls is attached to. Default is :code:`this`\n\n::\n\n JS_REVERSE_JS_GLOBAL_OBJECT_NAME = 'window'\n\n\nOptionally, you can disable the minfication of the generated javascript file\nby django setting\n\n::\n\n JS_REVERSE_JS_MINIFY = False\n\n\nBy default all namespaces are included\n\n::\n\n JS_REVERSE_EXCLUDE_NAMESPACES = []\n\nTo exclude any namespaces from the generated javascript file, add them to the `JS_REVERSE_EXCLUDE_NAMESPACES` setting\n\n::\n\n JS_REVERSE_EXCLUDE_NAMESPACES = ['admin', 'djdt', ...]\n\nIf you want to include only specific namespaces add them to the `JS_REVERSE_INCLUDE_ONLY_NAMESPACES` setting\ntips:\n* Use \"\" (empty string) for urls without namespace\n* Use \"foo\\0\" to include urls just from \"foo\" namaspace and not from any subnamespaces (e.g. \"foo:bar\")\n\n::\n\n JS_REVERSE_INCLUDE_ONLY_NAMESPACES = ['poll', 'calendar', ...]\n\nIf you run your application under a subpath, the collectstatic_js_reverse needs to take care of this.\nDefine the prefix in your django settings:\n\n::\n\n JS_REVERSE_SCRIPT_PREFIX = '/myprefix/'\n\nBy default collectstatic_js_reverse writes its output (reverse.js) to your project's STATIC_ROOT.\nYou can change the output path:\n\n::\n\n JS_REVERSE_OUTPUT_PATH = 'some_path'\n\n\nRunning the test suite\n----------------------\n\n::\n\n make test\n\nLicense\n-------\n\n`MIT `_\n\n\nContact\n-------\n\n`@i_error `_\n\n--------------\n\nEnjoy!\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "http://pypi.python.org/pypi/django-js-reverse/", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ierror/django-js-reverse", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-js-reverse-webpack", "package_url": "https://pypi.org/project/django-js-reverse-webpack/", "platform": "", "project_url": "https://pypi.org/project/django-js-reverse-webpack/", "project_urls": { "Download": "http://pypi.python.org/pypi/django-js-reverse/", "Homepage": "https://github.com/ierror/django-js-reverse" }, "release_url": "https://pypi.org/project/django-js-reverse-webpack/0.0.1/", "requires_dist": [ "Django (>=1.5)" ], "requires_python": "", "summary": "Javascript url handling for Django that doesn't hurt.", "version": "0.0.1" }, "last_serial": 4261855, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "7cac4307b0e8b7a5a02d8282b6b5323d", "sha256": "b318f67591b2e700cd50764ef48b2a63536583acc5aa8898a15e2aacc40fa3de" }, "downloads": -1, "filename": "django_js_reverse_webpack-0.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7cac4307b0e8b7a5a02d8282b6b5323d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20180, "upload_time": "2018-09-11T15:15:11", "url": "https://files.pythonhosted.org/packages/40/2e/b6f1065af0aeb1d7411922a94199f0bea29036f4d1dafd903ff775508b5e/django_js_reverse_webpack-0.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e6a7c0ef2cf75f9e667461d782f50c2e", "sha256": "747a35f5867656f5c0b8a34cfc7fe5e45ad6e418373583d737c08a554a7f86e1" }, "downloads": -1, "filename": "django-js-reverse-webpack-0.0.0.tar.gz", "has_sig": false, "md5_digest": "e6a7c0ef2cf75f9e667461d782f50c2e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19134, "upload_time": "2018-09-11T15:15:12", "url": "https://files.pythonhosted.org/packages/50/f1/4ea71f53868a4040063e256e9afffabe0324e4e0dbf6581a66ca7890f62f/django-js-reverse-webpack-0.0.0.tar.gz" } ], "0.0.1": [ { "comment_text": "", "digests": { "md5": "f6af1985efb282e1458f61b9b7026cc2", "sha256": "7789e74853110298261ecab572755a1503ac2d8497fadc8471b6708d3d757ea7" }, "downloads": -1, "filename": "django_js_reverse_webpack-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f6af1985efb282e1458f61b9b7026cc2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20221, "upload_time": "2018-09-11T16:01:47", "url": "https://files.pythonhosted.org/packages/2f/76/709b38587a81dde89a25b238a2c70466931b57f92b0e08a24cb45892b882/django_js_reverse_webpack-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "43c3d2331f7da63a886f4b0f7bde02da", "sha256": "e2b78a5bea2aa53247843c058a60c0315821d301c94be4265c7819423b8a5de0" }, "downloads": -1, "filename": "django-js-reverse-webpack-0.0.1.tar.gz", "has_sig": false, "md5_digest": "43c3d2331f7da63a886f4b0f7bde02da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19136, "upload_time": "2018-09-11T16:01:49", "url": "https://files.pythonhosted.org/packages/b0/c6/9ab095f034fc3fcb8f65d9e53e9c7122a640d495c696f152bb774690bfd0/django-js-reverse-webpack-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f6af1985efb282e1458f61b9b7026cc2", "sha256": "7789e74853110298261ecab572755a1503ac2d8497fadc8471b6708d3d757ea7" }, "downloads": -1, "filename": "django_js_reverse_webpack-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f6af1985efb282e1458f61b9b7026cc2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20221, "upload_time": "2018-09-11T16:01:47", "url": "https://files.pythonhosted.org/packages/2f/76/709b38587a81dde89a25b238a2c70466931b57f92b0e08a24cb45892b882/django_js_reverse_webpack-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "43c3d2331f7da63a886f4b0f7bde02da", "sha256": "e2b78a5bea2aa53247843c058a60c0315821d301c94be4265c7819423b8a5de0" }, "downloads": -1, "filename": "django-js-reverse-webpack-0.0.1.tar.gz", "has_sig": false, "md5_digest": "43c3d2331f7da63a886f4b0f7bde02da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19136, "upload_time": "2018-09-11T16:01:49", "url": "https://files.pythonhosted.org/packages/b0/c6/9ab095f034fc3fcb8f65d9e53e9c7122a640d495c696f152bb774690bfd0/django-js-reverse-webpack-0.0.1.tar.gz" } ] }