from django import forms class MultiSelectFormField(forms.MultipleChoiceField): """ http://djangosnippets.org/snippets/1200/ """ widget = forms.CheckboxSelectMultiple def __init__(self, *args, **kwargs): self.max_choices = kwargs.pop('max_choices', 0) super(MultiSelectFormField, self).__init__(*args, **kwargs) def clean(self, value): if not value and self.required: raise forms.ValidationError(self.error_messages['required']) return value