I thought the same thing at first, and ended up making my own class
that bound the forms and models together (a little like
form_for_model, but handles multiple 1-1 models).   I thought it would
save me a lot of time, but looking back I've only been able to use it
on a few forms.  I think the decision to keep them separate is really
for the best.  It's a few more lines of code, but everything is clear
and very flexible.   You just have to override the init and save
methods on the form to handle your models.  This post in django-users
was helpful for that:   "Newforms practice (common situation)"  You
control all the interaction, and there aren't any smoke and mirrors.

There isn't anything keeping you from using the model definitions to
dynamically build the form and save in init if you really want to
(that's what I did).  It's really revealing to look at the
form_for_model function code.  It's amazingly short (like 15 lines or
so), and should give you a good idea of how to do it.  It's probably a
really bad idea though because you could be in for a painful divorce
if they change the model implementation much.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to