Hi Yuri, thanks for your toughts. 2011/4/2 burc...@gmail.com <burc...@gmail.com>: > Gregor, > > Regarding proposal itself, > > the idea to make django form rendering based on templates is good, but > I think it should be simple, modular and not much verbose. > I'd like more to see more modular, but easier syntax: > 1) If you have to render form in your custom way, you have to write > all form fields (you'll tweak their order and widgets anyway later, so > it's a plus). > 2) If you have to render field in your custom way, you have to write > your own widget or widget template. > 3) Any advanced form customization can be made using templates. > > Something like this: > {% renderform form1 using layout "uni_form" %} {# errors output could > be changed with layout templates only #} > {# will use template layouts/app1/uni_form/charfield/x.html if it > was charfield. #} > {% render field1 using widget template "x" set class="field1" %} > {% render field3 %} > {% render field2 %} > {% endrenderform %}
If I get your ideas right, then my proposed {% form %} and {% formblock %} tag already supports what you suggested. I try to rewrite your example with my proposed syntax: {% formblock form1 using layout "uni_form" %} {% form form1.field1 using widget template "x" and addclass "field1" %} {% form form1 using fields "field3" "field2" %} {% endformblock %} The things that are different to your example are just some minor syntax things. Additionally, the "rendering modifiers" (in this case "widget" and "addclass") are not specified yet and I don't settled on a fixed set yet. I would like to defer this until a later point because thats something that need a broader discussion and IMO shouldn't take place in this thread, discussing the more basic concerns regarding my proposal. Or did I misunderstand what you tried to express? If thats the case, sorry for that and please clarify that for me. I would appreciate your feedback. (btw: a difference to your example is that I use the form tag to render forms and single fields. I will include why I choose to do this in my response later to Russell's post -- sorry I need to get offline but will respond again in the next few hours) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.