**WARNING: a better version of this snippet you can see at [http://www.djangosnippets.org/snippets/1051/](http://www.djangosnippets.org/snippets/1051/)**
This filter spec is util only for who uses newforms-admin branch.
To use this, you need to extend the class ModelAdmin for your model class, like the MyClassAdmin class in the code, with attention to the following lines:
# Appends the filter
cl.filter_specs.insert(0, AlphabeticFilterSpec(cl.lookup_opts.get_field('name'),request,cl.params,self.model,self))
Observation: depends on jQuery to works!
This widget works like other multiple select widgets, but it shows a drop down field for each choice user does, and aways let a blank choice at the end where the user can choose a new, etc.
Example using it:
class MyForm(forms.ModelForm):
categories = forms.Field(widget=DropDownMultiple)
def __init__(self, *args, **kwargs):
self.base_fields['categories'].widget.choices = Category.objects.values_list('id', 'name')
super(MyForm, self).__init__(*args, **kwargs)
- newforms
- multiple
- forms
- jquery
- select
- widget