diff --git a/events/forms.py b/events/forms.py
index 3e4afaf8..430e4973 100644
--- a/events/forms.py
+++ b/events/forms.py
@@ -27,8 +27,36 @@ from events.common import MEMBERS, VISITORS, PRICE
from events.common import members_mapping, visitors_mapping, price_mapping
+class FilterCheckboxSelectMultiple(forms.CheckboxSelectMultiple):
+ def render(self, name, value, attrs=None, choices=()):
+ if value is None: value = []
+ has_id = attrs and 'id' in attrs
+ final_attrs = self.build_attrs(attrs, name=name)
+ output = ['
']
+ # Normalize to strings
+ str_values = set([force_text(v) for v in value])
+ for i, (option_value, option_label) in enumerate(chain(self.choices, choices)):
+ # If an ID attribute was given, add a numeric index as a suffix,
+ # so that the checkboxes don't all have the same ID attribute.
+ if has_id:
+ final_attrs = dict(final_attrs, id='%s_%s' % (attrs['id'], i))
+ label_for = format_html(u' for="{0}"', final_attrs['id'])
+ else:
+ label_for = ''
+
+ cb = forms.CheckboxInput(final_attrs, check_test=lambda value: value in str_values)
+ option_value = force_text(option_value)
+ rendered_cb = cb.render(name, option_value)
+ option_label = force_text(option_label)
+ output.append(format_html(u'