{
"info": {
"author": "Lorenzo Pe\u00f1a",
"author_email": "lorinkoz@gmail.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 4 - Beta",
"Framework :: Django",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7"
],
"description": "django-js-choices\n=================\n\n.. image:: https://img.shields.io/badge/packaging-poetry-purple.svg\n :alt: Packaging: poetry\n :target: https://github.com/sdispater/poetry\n\n.. image:: https://img.shields.io/badge/code%20style-black-black.svg\n :alt: Code style: black\n :target: https://github.com/ambv/black\n\nOverview\n--------\n\nDjango JS Choices is a small Django app that makes handling of\n`model field choices`_ in javascript easy.\n\n.. _model field choices: https://docs.djangoproject.com/en/dev/ref/models/fields.html#django.db.models.Field.choices\n\nFor example, given the model...\n\n.. code-block:: python\n\n # models.py:\n\n class Student(models.Model):\n FRESHMAN = 'FR'\n SOPHOMORE = 'SO'\n JUNIOR = 'JR'\n SENIOR = 'SR'\n YEAR_IN_SCHOOL_CHOICES = (\n (FRESHMAN, 'Freshman'),\n (SOPHOMORE, 'Sophomore'),\n (JUNIOR, 'Junior'),\n (SENIOR, 'Senior'),\n )\n year_in_school = models.CharField(\n max_length=2,\n choices=YEAR_IN_SCHOOL_CHOICES,\n default=FRESHMAN,\n )\n\n...the choices are accesible in javascript.\n\n.. code-block:: javascript\n\n Choices.pairs(\"year_in_school\");\n\nResult:\n\n.. code-block:: javascript\n\n [\n {value: \"FR\", label: \"Freshman\"},\n {value: \"SO\", label: \"Sophomore\"},\n {value: \"JR\", label: \"Junior\"},\n {value: \"SR\", label: \"Senior\"}\n ]\n\nDisplay values are also accesible.\n\n.. code-block:: javascript\n\n Choices.display(\"year_in_school\", \"FR\")\n Choices.display(\"year_in_school\", {\"year_in_school\": \"FR\"})\n\nIn both cases the result is\n\n.. code-block:: javascript\n\n \"Freshman\"\n\n\nRequirements\n------------\n\n- Python (2.7+, 3.5+)\n- Django (1.5+)\n\n\nInstallation\n------------\n\nInstall using ``pip``...\n\n.. code-block:: bash\n\n pip install django-js-choices\n\n...or clone the project from GitHub.\n\n.. code-block:: bash\n\n git clone https://github.com/lorinkoz/django-js-choices.git\n\nAdd ``'django_js_choices'`` to your ``INSTALLED_APPS`` setting.\n\n.. code-block:: python\n\n INSTALLED_APPS = (\n ...\n 'django_js_choices',\n )\n\n\nUsage as static file\n--------------------\n\nFirst generate static file by\n\n.. code-block:: bash\n\n python manage.py collectstatic_js_choices\n\nIf you add apps, models, or change some existing choices,\nyou may update the choices.js file by running the command again.\n\nThe choices files is always created with a locale prefix: ``choices-en-us.js``\nbut you can pass any locale to the command...\n\n.. code-block:: bash\n\n python manage.py collectstatic_js_choices --locale es\n\n...and the generated file will be ``choices-es.js``\n\nAfter this add the file to your template.\n\n.. code-block:: html\n\n \n\n\nUsage with views\n----------------\n\nInclude non-cached view...\n\n.. code-block:: python\n\n from django_js_choices.views import choices_js\n urlpatterns = [\n url(r'^jschoices/$', choices_js, name='js_choices'),\n ]\n\n...or use cache to save some bandwith.\n\n.. code-block:: python\n\n from django_js_choices.views import choices_js\n\n urlpatterns = [\n url(r'^jschoices/$', cache_page(3600)(choices_js), name='js_choices'),\n ]\n\nInclude javascript in your template.\n\n.. code-block:: html\n\n \n\n\nUsage as template tag\n---------------------\n\nIf you want to generate the javascript code inline, use the template tag.\n\n.. code-block:: html\n\n {% load js_choices %}\n \n\n\nUse the choices in javascript\n-----------------------------\n\nFor every model field with choices, they will be available by the following\nnames.\n\n.. code-block:: javascript\n\n Choices.pairs(\"__\")\n Choices.pairs(\"_\")\n Choices.pairs(\"\")\n\nIf any of these names conflict with other model fields,\nthe conflicting names won't be accessible to prevent ambiguity.\n\n\nOptions\n-------\n\nOptionally, you can overwrite the default javascript variable 'Choices' used\nto access the choices by Django setting.\n\n.. code-block:: python\n\n JS_CHOICES_JS_VAR_NAME = 'Choices'\n\nOptionally, you can change the name of the global object the javascript\nvariable used to access the choices is attached to. Default is ``this``.\n\n.. code-block:: python\n\n JS_CHOICES_JS_GLOBAL_OBJECT_NAME = 'window'\n\nOptionally, you can disable the minfication of the generated javascript file\nby Django setting.\n\n.. code-block:: python\n\n JS_CHOICES_JS_MINIFY = False\n\nBy default collectstatic_js_choices writes its output (`choices-en-us.js`)\nto your project's `STATIC_ROOT`, but you can change the output path.\n\n.. code-block:: python\n\n JS_CHOICES_OUTPUT_PATH = 'some/other/path'\n\n\nRunning the test suite\n----------------------\n\nNOT YET AVAILABLE\n\n\nCredits\n-------\n\nInspired by (and conceptually forked from)\n`django-js-reverse `_\n",
"description_content_type": "text/x-rst",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/lorinkoz/django-js-choices",
"keywords": "django,choices,javascript",
"license": "MIT",
"maintainer": "Lorenzo Pe\u00f1a",
"maintainer_email": "lorinkoz@gmail.com",
"name": "django-js-choices",
"package_url": "https://pypi.org/project/django-js-choices/",
"platform": "",
"project_url": "https://pypi.org/project/django-js-choices/",
"project_urls": {
"Homepage": "https://github.com/lorinkoz/django-js-choices",
"Repository": "https://github.com/lorinkoz/django-js-choices"
},
"release_url": "https://pypi.org/project/django-js-choices/0.2.4/",
"requires_dist": [
"django (>=1.5,<3.0)"
],
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"summary": "Javascript model field choices handling for Django.",
"version": "0.2.4"
},
"last_serial": 4659015,
"releases": {
"0.1.0": [
{
"comment_text": "",
"digests": {
"md5": "16ccb849be1ade3f642e0c27e9b87acb",
"sha256": "6f47e161c38421ea49267308f52459c6893fa6dae89c851bdc1911a4e4672164"
},
"downloads": -1,
"filename": "django_js_choices-0.1.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "16ccb849be1ade3f642e0c27e9b87acb",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 10798,
"upload_time": "2017-06-08T17:04:55",
"url": "https://files.pythonhosted.org/packages/e6/de/594f45dc5673d35432623f0f565c147b7178922d29d7c22c74e18d2e772a/django_js_choices-0.1.0-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "19c9e24f4f0888686739fc279f59249b",
"sha256": "3a00a710fb9463ec0c7cea2593580a1aa11c06d293e5b7cee6d54f7c8d0a6131"
},
"downloads": -1,
"filename": "django-js-choices-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "19c9e24f4f0888686739fc279f59249b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7643,
"upload_time": "2017-06-08T17:04:58",
"url": "https://files.pythonhosted.org/packages/e0/84/b822cdf694bdb09114bf4623f5ca4ce635995c2efbfc1849fe4c5fe3b221/django-js-choices-0.1.0.tar.gz"
}
],
"0.1.1": [
{
"comment_text": "",
"digests": {
"md5": "473cbd07b0c5ebf7964978f85ba61fab",
"sha256": "4048783355bffebb18a58384cc659e51fbacea3f1322e4c7f6d2acd75f4bafb2"
},
"downloads": -1,
"filename": "django_js_choices-0.1.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "473cbd07b0c5ebf7964978f85ba61fab",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 10954,
"upload_time": "2017-06-08T20:24:13",
"url": "https://files.pythonhosted.org/packages/47/9b/2fcd6409a19bd2b9705a9e682418baf08f28e944dd1ae3ba9d377ffad5cb/django_js_choices-0.1.1-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "623c756913f95cef6bc41bbfc323e42f",
"sha256": "7842ecfb51120c383ebe084b366156e73aa46a7fe097705e0af0882d26589472"
},
"downloads": -1,
"filename": "django-js-choices-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "623c756913f95cef6bc41bbfc323e42f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7796,
"upload_time": "2017-06-08T20:24:15",
"url": "https://files.pythonhosted.org/packages/2d/a8/90e61c88c6c04180941604c798be56f815c2754e195c0c2b7a67157b74d6/django-js-choices-0.1.1.tar.gz"
}
],
"0.2.0": [
{
"comment_text": "",
"digests": {
"md5": "4e425c6b1bfaa004b8e4eaf6409692f0",
"sha256": "754479308ea23427d760bb0a4145be97fdf930db1164af09e0bb7fcee7e8db22"
},
"downloads": -1,
"filename": "django_js_choices-0.2.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "4e425c6b1bfaa004b8e4eaf6409692f0",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 15163,
"upload_time": "2017-06-09T17:58:11",
"url": "https://files.pythonhosted.org/packages/a1/11/39b47f90ca8d712bada2ab746a148aa1be55afeee3a46b29bfc7cb1c9543/django_js_choices-0.2.0-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "7f09977e8ab692b5707ad40a31306517",
"sha256": "a424c14bee3cf5306715de8636e60b74e403c0f25c7d52b7f7e3364ecdd93b01"
},
"downloads": -1,
"filename": "django-js-choices-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "7f09977e8ab692b5707ad40a31306517",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10287,
"upload_time": "2017-06-09T17:58:13",
"url": "https://files.pythonhosted.org/packages/02/fd/0e2f10b3bc429cfe9eb0142224a1716490c2095d553762f338bc76a24b59/django-js-choices-0.2.0.tar.gz"
}
],
"0.2.1": [
{
"comment_text": "",
"digests": {
"md5": "d9be678479c81dd73a34c6d4d034ee56",
"sha256": "44c8527420f2d66e9e10e8ea53a8f1758a2caa206fa5deee45a0d6cb174ceb4a"
},
"downloads": -1,
"filename": "django_js_choices-0.2.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "d9be678479c81dd73a34c6d4d034ee56",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 15164,
"upload_time": "2017-06-15T14:32:28",
"url": "https://files.pythonhosted.org/packages/e8/ce/31ee7d59a9de4c3a67a8f474f37640e2cdd7a1a4b7a695c2fecbefe70eed/django_js_choices-0.2.1-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "44009db0373c7825f1580e14932d8542",
"sha256": "77599bbbc18efd692c4807a38c18041b678044f3e937796e17ca63708cf36fa7"
},
"downloads": -1,
"filename": "django-js-choices-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "44009db0373c7825f1580e14932d8542",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10287,
"upload_time": "2017-06-15T14:32:32",
"url": "https://files.pythonhosted.org/packages/7a/d1/b731aac6c66860352d7de5f45ecb67b87d6f1e4c51ccd7d607589137249f/django-js-choices-0.2.1.tar.gz"
}
],
"0.2.2": [
{
"comment_text": "",
"digests": {
"md5": "acf2c2031b8bb213b23ff28b866b307a",
"sha256": "ed26dcf29df0abfaf73886b86421cfc1112d42f55e5eeb4f898b934e98f862de"
},
"downloads": -1,
"filename": "django_js_choices-0.2.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "acf2c2031b8bb213b23ff28b866b307a",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 15183,
"upload_time": "2017-12-30T04:07:29",
"url": "https://files.pythonhosted.org/packages/db/f4/951f016a9b96aa84adbc2abf4c3727053c5e6a8f4413f810eae3d303e0b2/django_js_choices-0.2.2-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "cce578e0219ebf9772d90a6d1bd364d3",
"sha256": "98010974dff7a03c949e709c591b6546d2e4d4098729664011b9589cb0994022"
},
"downloads": -1,
"filename": "django-js-choices-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "cce578e0219ebf9772d90a6d1bd364d3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10316,
"upload_time": "2017-12-30T04:07:42",
"url": "https://files.pythonhosted.org/packages/13/1e/7d0ff6662dce1ce8ab14364c4df7c0adf8dd593b5c23d0d10bce4c6d13d8/django-js-choices-0.2.2.tar.gz"
}
],
"0.2.4": [
{
"comment_text": "",
"digests": {
"md5": "78e250d766046c5fb4a826d810344b59",
"sha256": "eda079f99e345ee0b4d2f6e682313dcf67764e0d22d925a688f7d0fb0ed3b3b6"
},
"downloads": -1,
"filename": "django_js_choices-0.2.4-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "78e250d766046c5fb4a826d810344b59",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"size": 29972,
"upload_time": "2019-01-04T06:00:36",
"url": "https://files.pythonhosted.org/packages/aa/30/0f2753abefd3d5a0a1b1155d9d69b2337ade982e398cc6fe0f95bc6d6712/django_js_choices-0.2.4-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "6e4d4cc8617f14839d5a9f50943b0a7a",
"sha256": "b462017c25e3981b162a53232bd29b5e79c356fb5da918f468061d6e7667ba58"
},
"downloads": -1,
"filename": "django-js-choices-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "6e4d4cc8617f14839d5a9f50943b0a7a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"size": 12103,
"upload_time": "2019-01-04T06:00:32",
"url": "https://files.pythonhosted.org/packages/fe/c2/c86775bcd7b6512bd9af072351b4b80c43e4ece39ef189fdd723a840d952/django-js-choices-0.2.4.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "78e250d766046c5fb4a826d810344b59",
"sha256": "eda079f99e345ee0b4d2f6e682313dcf67764e0d22d925a688f7d0fb0ed3b3b6"
},
"downloads": -1,
"filename": "django_js_choices-0.2.4-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "78e250d766046c5fb4a826d810344b59",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"size": 29972,
"upload_time": "2019-01-04T06:00:36",
"url": "https://files.pythonhosted.org/packages/aa/30/0f2753abefd3d5a0a1b1155d9d69b2337ade982e398cc6fe0f95bc6d6712/django_js_choices-0.2.4-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "6e4d4cc8617f14839d5a9f50943b0a7a",
"sha256": "b462017c25e3981b162a53232bd29b5e79c356fb5da918f468061d6e7667ba58"
},
"downloads": -1,
"filename": "django-js-choices-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "6e4d4cc8617f14839d5a9f50943b0a7a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"size": 12103,
"upload_time": "2019-01-04T06:00:32",
"url": "https://files.pythonhosted.org/packages/fe/c2/c86775bcd7b6512bd9af072351b4b80c43e4ece39ef189fdd723a840d952/django-js-choices-0.2.4.tar.gz"
}
]
}