On Apr 7, 2:15 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> >  I'd still like to see form_for_model stay (or be replaced by the above
> >  or similar) rather than being deprecated.
>
> Personally I don't see much call for it; dynamically building a
> ModelForm is easy enough, and maintaining two distinct ways to do the
> same thing just feels like clutter.

I think this actually comes down to a wider philosophical point about
declarative syntax. Declarative syntax based on metaclasses has become
quite a popular pattern in Django, but it comes at the expense of easy
dynamic creation of objects. The ModelForm example in this thread is
one example; dynamically constructing a newforms instance is another.
I would rather see declarative syntax as syntactic sugar over a more
traditional API than declarative syntax as the only way to do things
(and crazy closure-based dynamic class hacks to support the dynamic
creation case).

Newforms is a particularly good example - there are many cases in
which it makes sense to dynamically assemble a form at runtime
(providing one form field for each day of the current month, for
example) but the current implementation is focused on declarative
forms - dynamically adding fields requires knowledge of newforms
internals. I'd rather have a set of documented APIs for building a
form up one field at a time, with a metaclass-based declarative
wrapper over the top that makes use of that underlying API.

Cheers,

Simon
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to