to be more precise:
when I do "print form" in formsets.py in line 96, at the end of
_construct_form, the form is there.
but when trying to display the form(s) in the template, the formset is
empty ...

On Aug 21, 12:19 pm, patrickk <[EMAIL PROTECTED]> wrote:
> thanks justin.
>
> I´m able to pass the paramters to the form now. unfortunately, the
> form (in the template) is empty now ... no fields at all, so I guess
> there´s something missing here (but I don´t know what).
>
> On Aug 21, 11:34 am, "Justin Fagnani" <[EMAIL PROTECTED]>
> wrote:
>
> > On Thu, Aug 21, 2008 at 12:30 AM, patrickk <[EMAIL PROTECTED]> wrote:
>
> > > I´m not sure (anymore) we´re all talking about the same issue.
>
> > I think we are. I'll see if I can clarify... The broad idea is that
> > you pass the parameters to the formset in your view via an overridden
> > __init__(), then you pass them to the form via an overridden
> > _construct_form().
>
> > Something like this:
>
> > class MyBaseFormSet(BaseFormSet):
> >   def __init__(self, foo=None, **kwargs):
> >     self.foo = foo
> >     super(BaseFormSet, self).__init__(**kwargs)
>
> >   def _construct_form(self, i, **kwargs):
> >     # this works because BaseFormSet._construct_form() passes **kwargs
> >     # to the form's __init__()
> >     super(BaseFormSet, self)._construct_form(i, **{'foo': self.foo})
>
> > class MyForm(Form):
> >   def __init__(self, foo=None, *args, **kwargs):
> >     self.foo = foo
> >     super(BaseForm, self).__init__(*args, **kwargs)
>
> > MyFormSet = formset_factory(MyForm, formset=MyBaseFormSet)
>
> > def view_func(request):
> >   formset = MyFormSet(foo='bar')
> >   ...
>
> > hope that helps,
> >   Justin
>
>
--~--~---------~--~----~------------~-------~--~----~
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