4 ms·
Forms are the biggest difference between Rails itself and Rails-inspired Python frameworks (I'm talking about Pylons's default helpers, Toscawidgets and Django
by old-gregg 17y ago
Forms are the biggest difference between Rails itself and Rails-inspired Python frameworks (I'm talking about Pylons's default helpers, Toscawidgets and Django here)
After working with Rails for 3 years I am absolutely don't get the need for "form" classes. And indeed, judging by open sourced projects and posted code examples, submit handlers in Django and Pylons always look insanely complex as compared to Rails.
- kgrin 17y agoDjango isn't Rails-inspired - they were developed at around the same time, with no real awareness of each other (at first). As to the merits of "form" classes and post handlers, I think the complexity is only there if you need it, if you're doing something more interesting (read: complex) than CRUD-type inserts/updates and basic validation (if that's all you're doing, ModelForms are pretty close to magical and light on syntax).
- kaveri 17y agoDjango forms (and their non-Django counterpart, WTForms) are very easy to use, with a declarative syntax. The advantage is that validation is decoupled from models. Often you need to handle validation which doesn't directly involve a single model - for example sending an email, or handling updates to a number of models. This saves you having to litter your controller/views with validation code.