On Thu, 2009-01-22 at 08:37 +0900, Russell Keith-Magee wrote: > On Thu, Jan 22, 2009 at 7:39 AM, catsclaw <ch...@subtlety.com> wrote: [...]
> > Adding a > > widget therefore requires rewriting the field classes you want the > > widget to be used with, rather than letting the widget interrogate the > > field classes. That's not great design, and it means any changes to > > form rendering becomes a major pain. > > Again - examples abound in the Django source tree that demonstrate > that this simply isn't true. 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). There's a little leakage, in the sense that field classes can pass down attributes, but its' not required. Also, the attributes that are passed down are a pretty common set (and, by and large, arbitrary, as they're just a dictionary, so you can pass in whatever you like via the form or fields). If there's a concrete example of what you can't get, that would be good to outline. I suspect that that is why some people might prefer the opposite direction for the dependencies, with widgets able to query fields. However that would lead to a different and, likely, greater set of problems with, for example, the over-arching form subclasses not able to get a hold of the bigger picture of what they're managing. To solve that and allow the reverse-dependencies, you end up having mutual dependencies, which bring their own set of problems to the table, in the design sense. 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? Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---