Re:Django's Architecture: The Good, The Bad, and The Ugly
by huxley on Sunday June 16, 2013 @12:41PM
(#5888966)
For a big subset of stuff, the Django forms are perfectly fine once you grok what they do, but in recent years, I've usually supplemented them with CrispyForms [1] (used to django-uni-form) and FloppyForms [2] --either individually or in combo-- for extra form flexibility.
Re:Django's Architecture: The Good, The Bad, and The Ugly
by sashahart on Sunday June 16, 2013 @11:57AM
(#5888818)
I'm curious about 'field helpers,' can you point to a page or briefly describe the difference?
Re:Django's Architecture: The Good, The Bad, and The Ugly
by mattchew on Sunday June 16, 2013 @01:13PM
(#5889081)
Sure, I mean helpers for the template/view that make it easier (syntax, data binding, validations) to render a HTML form widget. Instead of defining your form as a unit in app code, you manage the form fields in the view/template. For my money, this is much more intuitive and flexible.
It's common in other web frameworks. At least Codeigniter, Ruby on Rails, and ASP.NET MVC use this approach:
http://ellislab.com/codeigniter/user-guide/helpers/form_help...
http://guides.rubyonrails.org/form_helpers.html
http://msdn.microsoft.com/en-us/library/dd410596(v=vs.100).a...
Re:Django's Architecture: The Good, The Bad, and The Ugly
by lojack on Sunday June 16, 2013 @12:20PM
(#5888897)
Not 100% sure this is what mattchew was talking about, but instead of defining the form and then rendering the form field by doing something like this:
> {{ form.thefield }}
You would instead simply define the model and render the form field with something like this:
> {{ model.thefield | render_input }}
Or, if you had a regular Form (i.e. not a ModelForm) you would do something like this:
> {{ render_input:name="field_name" }}
And if you wanted validation or something, you'd need to create your own render_* methods to perform that validation.
Re:Django's Architecture: The Good, The Bad, and The Ugly
by RussianCow on Sunday June 16, 2013 @12:29PM
(#5888923)
Really? I find that to be one of Django's biggest wins for me. The only thing I dislike about it is that you need to use multiple forms if you need to wrap multiple models. But having forms that aren't tied to a model is so easy in Django.
It doesn't seem to be a common complaint, but I always end up fighting with Forms when I try to use them. Too complicated, too confining, and too unique-to-Django. I wish Django had gone with field helpers instead.