[Fixed]-Django Admin form โ€“ How to override MultiSelectField class?

1๐Ÿ‘

โœ…

Add vCheckboxLabel in Model or Form class where you are defining that form.
If you are defining form using Form class then use:

myfield = forms.BooleanField(widget=forms.CheckboxInput(attrs={'class':'vCheckboxLabel'}))

If you are using models then add widget to the column. https://docs.djangoproject.com/en/1.8/topics/forms/modelforms/#specifying-widgets-to-use-in-the-form-with-widgets

Alternate:
For simplicity you can use java script on that page. Select checkbox class and change it to vCheckboxLabel. But it is not recommended.

๐Ÿ‘คHarish Kumar

Leave a comment