{ "info": { "author": "Jessamyn Smith", "author_email": "jessamyn.smith.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "django-select2-tags\n===================\n\n|Build Status| |Coverage Status|\n\n**django-select2-tags** provides a form class and form fields to handle storing new Django model\nvalues created using Select2_ fields with tags enabled. This is a rough project at the moment;\nit doesn't handle required fields well nor does form validation restore tags to inputs. It may\nstill help you out, and pull requests are welcome!\n\nTested on Python 2.7 and 3.5 with Django 1.10.\n\nLike my work? Tip me! https://www.paypal.me/jessamynsmith\n\n\nInstallation\n------------\n\nThe development version can be installed with:\n\n::\n\n pip install -e git://github.com/jessamynsmith/django-select2-tags.git#egg=django-select2-tags\n\nIf you are developing locally, your version can be installed from the\nworking directory with:\n\n::\n\n python setup.py.install\n\n\nUsage\n-----\n\nThe simplest way to use ``django-select2-tags`` is to use\n``select2_tags.forms.Select2ModelChoiceField`` and\n``select2_tags.forms.Select2ModelMultipleChoiceField`` in the ModelForm for\n``django.db.models.ForeignKey`` and\n``django.db.models.ManyToManyField`` model fields, respectively. These fields extend\ntheir django equivalents and take the same arguments, along with the required ``value_field``\nargument and an optional ``save_new`` keyword argument. Currently, this only works with\nnullable model fields, and you must pass ``required=False`` to the choice fields.\n\nIf you use the ``select2_tags.forms.Select2ModelForm`` in place of a regular ModelForm and set\nsave_new=True on any Select2 choice fields, the new values will be saved for you.\n\nGiven the following models:\n\n::\n\n class MyRelatedModel(models.Model):\n name = models.CharField(max_length=20)\n\n\n class MyModel(models.Model):\n my_fk_field = models.ForeignKey(MyRelatedModel, null=True, blank=True)\n my_m2m_field = models.ManyToManyField(MyRelatedModel)\n\nYou could create the following form to automatically save the select2 tag values:\n\n::\n\n from select2_tags import forms\n\n\n class MyFkForm(forms.Select2ModelForm):\n class Meta:\n model = MyModel\n exclude = []\n\n my_fk_field = forms.Select2ModelChoiceField(\n 'name', queryset=test_models.MyRelatedModel.objects.all(), required=False)\n my_m2m_field = forms.Select2ModelMultipleChoiceField(\n 'name', queryset=test_models.MyRelatedModel.objects.all(), required=False)\n\nYou will be able to enter new values on the edit page and they will be saved to the database,\nso long as select2 is set up with tags enabled:\n\n::\n\n $(\"#id_my_fk_field\").select2({\n tags: true\n });\n\n\nDevelopment\n-----------\n\nFork the project on github and git clone your fork, e.g.:\n\n::\n\n git clone https://github.com//django-select2-tags.git\n\nCreate a virtualenv and install dependencies:\n\n::\n\n mkvirtualenv django-select2-tags\n pip install -r requirements/package.txt -r requirements/test.txt\n\nRun tests with coverage (should be 100%) and check code style:\n\n::\n\n coverage run manage.py test\n coverage report -m\n flake8\n\nVerify all supported Python versions:\n\n::\n\n pip install tox\n tox\n\nInstall your local copy:\n\n::\n\n python setup.py install\n\n.. |Build Status| image:: https://img.shields.io/circleci/project/github/jessamynsmith/django-select2-tags.svg\n :target: https://circleci.com/gh/jessamynsmith/django-select2-tags\n :alt: Build status\n.. |Coverage Status| image:: https://img.shields.io/coveralls/jessamynsmith/django-select2-tags.svg\n :target: https://coveralls.io/r/jessamynsmith/django-select2-tags?branch=master\n :alt: Coverage status\n.. _Select2: http://ivaynberg.github.com/select2/", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/jessamynsmith/django-select2-tags/archive/0.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jessamynsmith/django-select2-tags", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-select2-tags", "package_url": "https://pypi.org/project/django-select2-tags/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-select2-tags/", "project_urls": { "Download": "https://github.com/jessamynsmith/django-select2-tags/archive/0.1.tar.gz", "Homepage": "https://github.com/jessamynsmith/django-select2-tags" }, "release_url": "https://pypi.org/project/django-select2-tags/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "Django forms that support new items entered using Select2 with tags enabled", "version": "0.0.1" }, "last_serial": 2691989, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d97a6e1188f7cb38ad1b5b9399278d2f", "sha256": "812b43aefb53c184139439f123b1c32f98463590ba41cb94f6c80393f0ddf950" }, "downloads": -1, "filename": "django-select2-tags-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d97a6e1188f7cb38ad1b5b9399278d2f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6363, "upload_time": "2017-03-08T16:15:38", "url": "https://files.pythonhosted.org/packages/d8/ed/af56acfa1595f69d1646a1e604b228d9de5c229b9b3edd21608f7f920559/django-select2-tags-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d97a6e1188f7cb38ad1b5b9399278d2f", "sha256": "812b43aefb53c184139439f123b1c32f98463590ba41cb94f6c80393f0ddf950" }, "downloads": -1, "filename": "django-select2-tags-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d97a6e1188f7cb38ad1b5b9399278d2f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6363, "upload_time": "2017-03-08T16:15:38", "url": "https://files.pythonhosted.org/packages/d8/ed/af56acfa1595f69d1646a1e604b228d9de5c229b9b3edd21608f7f920559/django-select2-tags-0.0.1.tar.gz" } ] }