• Stars
    star
    140
  • Rank 261,473 (Top 6 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 13 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

django FormFields using the Chosen javascript plugin for jQuery

django-chosen

django-chosen is a project that makes available django FormFields that uses the Chosen javascript plugin. It was created by developers at The Atlantic.

Note that there is a select field library with even more features available at 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 :

{{ form.media }}

Example

from django import forms
from chosen import forms as chosenforms

class 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. 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

Chosen Javascript Credits

More Repositories

1

django-nested-admin

Django admin classes that allow for nested inlines
Python
678
star
2

citylab-data

Resources, data, and methodology for CityLab data journalism projects
R
95
star
3

django-select2-forms

Django form fields using the Select2 jQuery plugin
Python
82
star
4

django-cropduster

Image uploader and cropping tool to create thumbnails at various aspect ratios
JavaScript
81
star
5

django-xml

A python module which provides an abstraction to lxml's XPath and XSLT functionality in a manner resembling django database models.
Python
43
star
6

django-autosave

Reusable autosave for the Django Admin
Python
42
star
7

thumbor-video-engine

An engine and tools for manipulating videos with thumbor using ffmpeg
Python
31
star
8

django-mysqlndb-backend

Provides a django database backend that works with MySQL Cluster's NDB storage engine
Python
12
star
9

python-monkey-business

Utility functions for monkey-patching python code
Python
11
star
10

python-blogger

A fork of python-blogger, a python wrapper around the Blogger, Metaweblog, Wordpress, MovableType API
Python
11
star
11

django-curation

Not to be confused with django-curated
Python
10
star
12

django-generic-plus

Django model field that behaves as both a GenericForeignKey and a FileField
Python
8
star
13

django-south

A git mirror of the django south mercurial repository
Python
6
star
14

django-partner-feeds

Save basic information from partner feeds in a database
Python
5
star
15

django-ko-demo

A rough demo of using nested inlines and knockout js to create a wysiwyg interface in the django admin
CSS
5
star
16

django-dart

DoubleClick DART tags for Django
Python
4
star
17

py4j-highcharts

A Py4J gateway server in Java that allows python applications to rasterize SVG to PNG
JavaScript
4
star
18

django-polymorphic-foreignkey

A polymorphic ForeignKey field that acts like a generic ForeignKey
Python
3
star
19

go-pensieve

Parse Krux data feed files and import into a Pilosa DB
Go
3
star
20

django-selenosis

Helpers for writing selenium tests for Django (formerly django-admin-testutils)
Python
3
star
21

jinja2-template-cache

A bytecode cache for jinja2 using django cache backends
Python
3
star
22

host

Scraping and parsing logic for David Foster Wallace's Host.
HTML
3
star
23

django-phatpages

Python
2
star
24

wpt-slack-spreadsheet

Profile a URL in WPT and send the relevant results to Slack and store all the results in a Google Spreadsheet.
JavaScript
2
star
25

django-fatpages

Flatpages for Django that integrates with the CKEditor
Python
2
star
26

blueconic

Blueconic Python library
Python
1
star
27

pysilverpop

Python Wrapper for Silverpop
Python
1
star
28

djangotoolbox

Mirror of the djangotoolbox bitbucket repository for django-nonrel
Python
1
star
29

django-admin-testutils

Helpers for writing selenium tests for the django admin
Python
1
star
30

kruxpy

Kruxpy is a library for dealing with the Krux / Salesforce DMP API
Python
1
star
31

django-contact-form

git clone of django-contact-form https://bitbucket.org/ubernostrum/django-contact-form/
Python
1
star
32

gulp-htmlhint-junit-reporter

jenkins-friendly junit reporter for gulp-htmlhint
JavaScript
1
star