On Dec 11, 2:10 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hello Guys,
>
> I am following this post about ModelForm and I am still puzzled on how
> this new class can address the dynamic generation of a form. I would
> like to see how it is possible to do it with this new API.
>
> Let us imagine that for an Online Survey application
> :http://yml.alwaysdata.net/
> I need to dynamically create a form representing an "Interview" to my
> user. This form is build with the following logic : it presents the
> "Survey" with all its related "Questions" and the "Choices" related to
> the question.
> A simple example can be seen
> there:http://yml.alwaysdata.net/apps/survey/interview/add/3/
>
> So the question behind this is how to display a form with nested
> ForeignKey.
This is something that is being addressed in newforms-admin. It is
necessary for django.contrib.admin and
django.views.generic.create_update (#3639 - newforms patch) to have
some helper function to dynamically create a ModelForm since the model
is not known until runtime. I think what you are trying to get at is
something similar to a FormSet found in the newforms-admin branch.
You might want to check it out.
> Thank you
> --yml
>
> On 11 déc, 04:22, Collin Grady <[EMAIL PROTECTED]> wrote:
>
> > Joseph Kocherhans said the following:
>
> > > I'm close to checking this in and adding a note to
> > > BackwardsIncompatibleChanges, but I'm still a little uneasy about
> > > generating the form fields at form instantiation time. It just feels
> > > weird to me, but I can't really come up with any actual reasons why. I
> > > mean, I think the functionality is neat, but I'm not comfortable with
> > > the syntax.
>
> > Looking at the latest patch, I don't think it ended up supporting that -
> > it instead only uses the fields defined in the common form, no
> > fields/exclude args required.
>
> > Though admittedly, I don't know ModelForms very well yet, so I could be
> > missing something :)
>
> > --
> > Collin Grady
>
> > Earth is a beta site.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---