Try django.forms.MultipleChoiceField()
. See https://docs.djangoproject.com/en/dev/ref/forms/fields/#multiplechoicefield
known_tags = ( (1, 'Choice 1'), (2, 'Choice 2'), (3, 'Choice 3'), (4, 'Choice 4'), (5, 'Choice 5')) class MyForm(django.forms.Form): tags = django.forms.MultipleChoiceField(choices=known_tags, required=True)
EDIT 1:
If you want to do this, turn the text field into an array ...
class MyForm(django.forms.Form): tags = django.forms.CharField(required=True) def clean_tags(self): """Split the tags string on whitespace and return a list""" return self.cleaned_data['tags'].strip().split()
source share