Lets say I need to filter the options available in a multiple select box.
in my view I have:
class ArticleCheckbox(forms.ModelForm):
article= forms.ModelMultipleChoiceField(queryset=Article.objects.all(),required=False, widget=forms.CheckboxSelectMultiple)
class Meta:
model = Book
fields = ('m2m_article',)
. In my view I will assign:
articleform = ArticleCheckbox()
articleform.fields["m2m_article"].queryset = Article.objects.filter(category = "Animals")
How does the assigning of the queryset in the view affect the queryset from classes (Article.object.all()) ? Does it overwrite? I do not think so.
I would like to override the queryset. How can I do it?