On Jan 21, 7:20 pm, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > In the larger scheme, I think this is one of those areas where people's > initial intuition differs. Django's form classes generally push > downwards, with the greater intelligence lying at the higher levels > (forms know the most, then form field classes have more localised > knowledge and the widgets have the least knowledge and are simply given > the information that they should present).
Well, I can see that; it just seems to me that a form (and fields) should be responsible for managing data on the server side, while a widget is responsible for managing data on the client side. It has to be, since the Fields aren't running there. > Again, specific issues would be easier to address here, rather than > general complaints. We have a lot of accumulated experience to suggest > the current design isn't a total disaster and I'm yet to find anything > that isn't possible in a fairly neat fashion with the current dependency > direction. So what sort of things are you trying to do where you can't > think of a way to implement them at the moment? I'm trying to replace some of form elements on my site with Dojo widgets. In some cases I can handle it by just modifying attributes. But my foray into all this began because I needed to have the widgets being rendered in a form aware of some properties set on the form itself--so I could say something like "if you're rendering an INPUT element, add a 'class=form-input' attribute to the rendered html". I initially assumed I could just subclass Form, and add my custom Widget parameter to each Field. Then my Form could check when rendering a Widget whether it was a custom widget or not, and call a special rendering method if it was. But the Form rendering logic doesn't make that easy at all. I ended first iterating over all the fields in the form and calling a method which tells it what to do when it gets rendered, every time it gets rendered. Then I call the normal rendering functions, which work as expected. But I'm not very happy with that, since it relies quite a lot on some of the internal details of how Forms work. -- Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---