I'm using Select2 in my application for creating tags-like select dropdowns. Users can select number of predefined tags or create a new tag.
Relevant forms class part:
all_tags = Tag.objects.values_list('id', 'word')# Tagstags = forms.ChoiceField(choices=all_tags,widget=forms.Select(attrs={'class': 'question-tags','multiple': 'multiple',}))
The problem is that Django
won't allow custom tags(choices) upon validation. There error I'm getting looks like this: Select a valid choice. banana is not one of the available choices.
Is there any way around it?
Thanks