I'm beginner in Django/Python and I need to create a multiple select form. I know it's easy but I can't find any example. i use django-taggit.i want to select multiple tag in tag form with search engine . here is my forms.py
class QuestionForm(forms.ModelForm):
test = Tag.objects.order_by('name')
for tag in test:
print(tag)
tags = forms.ModelMultipleChoiceField(label='Tags', queryset=Tag.objects.order_by('name'),widget=forms.SelectMultiple)
class Meta:
model = Question
fields = ['title', 'content','anonymous',"tags"]
widgets = {
'title' : forms.TextInput(attrs={'class':'form-control form-control form-control-lg '}),
'content' : forms.Textarea(attrs={'class':'form-control'}),
# 'tags' : forms.Textarea(attrs={'class':'form-control'}),
}
form.html
{{form.tags}}
i want this
