class FilteredSelect(forms.widgets.Select):
"""
Displays as an ordinary selectbox with an additional text-input for filtering the options.
Requires: http://www.barelyfitz.com/projects/filterlist/filterlist.js
Author: Konrad GiƦver Beiske
Company: Linpro
"""
class Media:
js = ('filterlist.js', )
pre_html = """
Filter:
Case-sensitive
"""
post_html = """
"""
def render(self, name, value, attrs=None, choices=()):
super_res = super(FilteredSelect, self).render(name, value, attrs=attrs, choices=choices)
return (self.pre_html%(name, name)) + super_res + (self.post_html%(name, name))