Django: How to add dynamic classes to select options in a form
问题 I have a ModelForm that I'm rendering in the template with django-widget-tweaks. I have a ChoiceField select that prints out something like this: <select> <option value="object.id">object.name</option> </select> But for Javascript manipulation purposes, I need the following: <select> <option value="object.id" class="object.otherPropery">object.name</option> </select> django-widget-tweaks has an add_class function, but it only adds a class to the select box, not the contained options. I have