Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theatlantic/django-chosen
django FormFields using the Chosen javascript plugin for jQuery
https://github.com/theatlantic/django-chosen
Last synced: about 1 month ago
JSON representation
django FormFields using the Chosen javascript plugin for jQuery
- Host: GitHub
- URL: https://github.com/theatlantic/django-chosen
- Owner: theatlantic
- License: other
- Created: 2011-07-29T19:58:49.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2020-12-16T17:51:22.000Z (almost 4 years ago)
- Last Synced: 2024-04-14T04:49:22.383Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 96.7 KB
- Stars: 140
- Watchers: 41
- Forks: 47
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
django-chosen
=============*django-chosen* is a project that makes available django FormFields that uses
the [Chosen javascript plugin](http://harvesthq.github.com/chosen/). It was
created by developers at [The Atlantic](http://www.theatlantic.com/).Note that there is a select field library with even more features available at
[https://github.com/theatlantic/django-select2-forms](https://github.com/theatlantic/django-select2-forms).
Most implementation work will go towards django-select2-forms.Installation
------------The recommended way to install from source is with pip:
pip install -e "git+https://github.com/theatlantic/django-chosen.git#egg=django-chosen"
If the source is already checked out, use setuptools:
python setup.py develop
or, you can install from pypi:
pip install django-chosen
Usage
-----*django-chosen* makes the following fields and widget available:
__Fields:__
* `ChosenChoiceField`
* `ChosenModelChoiceField`
* `ChosenMultipleChoiceField`
* `ChosenModelMultipleChoiceField`__Widgets:__
* `ChosenSelect`
* `ChosenSelectMultiple`The *django-chosen* fields can be passed an optional kwarg `overlay` that
overrides the text which appears when no option is selected in the dropdown.Add `chosen` to your `INSTALLED_APPS`, then, in your template, inject your form medias to get chosen css and js :
```html
{{ form.media }}
```Example
-------```python
from django import forms
from chosen import forms as chosenformsclass BookForm(forms.Form):
name = forms.CharField(max_length=100)
quality = chosenforms.ChosenChoiceField(overlay="Select book quality...",
choices=(('New', 'new'), ('Used', 'used')))
authors = chosenforms.ChosenModelMultipleChoiceField(queryset=Author.objects.all())
```License
-------
The django code is licensed under the
[Simplified BSD License](Simplified BSD License) and is copyright The Atlantic
Media Company. View the `LICENSE` file under the root directory for complete
license and copyright information.The Chosen javascript library included is licensed under the
[MIT License](http://en.wikipedia.org/wiki/MIT_License). View
`chosen/media/js/chosen.LICENSE.md` for complete license and copyright
information about the Chosen javascript library.Chosen Javascript Documentation
-------------------------------Chosen is a library for making long, unwieldy select boxes more user friendly.
- jQuery support: 1.4+
- Prototype support: 1.7+For documentation, usage, and examples, see
[Harvest's Chosen JS github](http://harvesthq.github.com/chosen)### Chosen Javascript Credits
- Built by [Harvest](http://www.getharvest.com/)
- Concept and development by [Patrick Filler](http://www.patrickfiller.com/)
- Design and CSS by [Matthew Lettini](http://matthewlettini.com/)