samedi 25 juillet 2020

How to test CheckboxSelectMultiple in save

I have a form (ModelForm) in Django, where I am adding a field for users in the init method as so:

self.fields["users"] = forms.ModelMultipleChoiceField(
    queryset=users, widget=forms.CheckboxSelectMultiple, required=False,label="Add Designer(s)"
)

In the save method how I can iterate over the queryset for this field, however I do not know how I can test if the particular model has been selected/checked. Help please.




Aucun commentaire:

Enregistrer un commentaire