There is a MultipleChoiceField object:
# forms.py options = [] for t in DocumentType.objects.all().values(): options.append((t['globalid'], t['type'])) doc_types = forms.MultipleChoiceField(choices=options, required=False,initial=True, widget=forms.CheckboxSelectMultiple())
I need a query that selects only the documents of the marked types from the Document table (the doc_type field in the views.py code is a foreign key with data from the DocumentType table). Logically, something like this request, but this code does not work:
# views.py doc_list = Document.objects doc_list = doc_list.filter(Q(doc_type__icontains=doc_types.value))
Tell me how to apply in the request to the selected CheckboxSelectMultiple elements, otherwise I do not find a clear description.