django-selectable-select2 0.2.2

Plugin for django-selectable (to use with select2 UI)
django-selectable-select2 is a kind of a plugin for django-selectable.

It provides widgets for use with a great JS library called select2 rather than jQuery UI. It also provides it's own Lookup classes for better (IMO) serialization results and limiting results (on server side).

For now there's only a basic single-valued autocomplete widget for usage on ForeignKey (or simply ModelChoiceField) fields.

Installation and usage

- install django-selectable (you can ommit the part regarding jquery-ui)

- add selectable_select2 to INSTALLED_APPS. So it look like this:


- define your lookup class


as for now (until issue #64 is resolved) you should inherit from selectable_select2.base.LookupBase and selectable_select2.base.ModelLookup

- in your forms you can use selectable_select2.widgets.AutoCompleteSelect2Widget like so:

 from selectable_select2.widgets import AutoCompleteSelect2Widget
 from django import forms

 from myapp.models import MyModel # example model with a ForeignKey called ``myfk``
 from myapp.lookups import MyModelLookup # the lookup defined in previous step

 class MyModelForm(forms.ModelForm):

 class Meta:
 model = MyModel
 widgets = {
 'myfk' : AutoCompleteSelect2Widget(MyModelLookup, placeholder='select related item')

Check the example project for more details.

last updated on:
September 21st, 2012, 13:41 GMT
developed by:
Slawek Ehlert
license type:
BSD License 
ROOT \ Internet \ HTTP (WWW)


In a hurry? Add it to your Download Basket!

user rating



Add your review!