Hacker News new | ask | show | jobs
by kyllo 3802 days ago
I agree with all of the above. Django's Model system is great, and function-based views work well too, but the class-based views and forms are misguided attempts to apply OOP principles where they aren't really needed. Inheritance is just not the right tool for the job, it creates more problems than it solves.
1 comments

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.