Emulating nested optgroups in Django Forms

Some motivation Django has a field called ChoiceField which lets you very easily create a <select> dropdown in your forms. A great feature is the ability to transform nested choices into appropriate <optgroup> groups. For instance, the following code: …creates a field that when rendered looks something like this:   The HTML that Django produced looks […]