Good evening I need to implement a multiple select in django and store the selected options in the model.
I appreciate the ideas that you give me since I am in need of this functionality.
Good evening I need to implement a multiple select in django and store the selected options in the model.
I appreciate the ideas that you give me since I am in need of this functionality.
Django already has a field for that. The only thing that is done is to define the widget, so it would be something like this:
OPTIONS = (
("OP1","Opcion 1"),
("OP2","Opcion 2"),
("OP3","OPcion 3"),
)
field = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=OPTIONS