django-selectable-select2 0.2.2

Plugin for django-selectable (to use with select2 UI)

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!
send us
an update
LICENSE TYPE:
BSD License 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Slawek Ehlert
HOMEPAGE:
bitbucket.org
CATEGORY:
ROOT \ Internet \ HTTP (WWW)
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:

 INSTALLED_APPS = (
 ...
 'selectable',
 'selectable_select2',
 ...
 )


- define your lookup class

Warning

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

requirements

#django-selectable plugin #select2 UI #Django #django-selectable #select2 #UI

Add your review!

SUBMIT