Hacker News new | ask | show | jobs
by true_religion 3808 days ago
I would have been satisfied if the forms use the django templating system, instead of trying to use string manipulation to create HTML somewhere in the bowls of a python file.

How great would this be?

name = BooleanField(template='switch_not_radio_boxes.html')

Your template file spits out HTML for flip switches instead of radio boxes (e.g. Https://proto.io/freebies/onoff/), and the template can add javascript/css to be bundled into a singular location with the rest of the Form fields static assets.

It'd be simple.

But nope, instead BooleanFields use a widget that creates HTML & sprinkles error messages upon it through some byzantine means.