[Zope3-Users] Re: Simple Add example for z3c.forms.subforms
srichter at cosmos.phy.tufts.edu
Fri Jul 13 11:56:09 EDT 2007
On Wednesday 04 July 2007 13:47, Hermann Himmelbauer wrote:
> My problem is that the doctest seems to lack an important part, namely the
> creation of the subobject and the assignment to the parent object. Where
> would I do this?
I would create a blank object and then use the sub-editform.
> I assume, I'd need a create() method - but where? In the subform? Or parent
> form? Or both - one for the sub-object, one for the parent?
That's up to you. I think having a sub-object addform makes things much more
complicated than you have to. As I said above, I would create a blank object
and use the edit subform.
> However, I don't really like this **self.owner.widgets.extract()
> statement, to my mind there should be a prettier way? Moreover, maybe the
> owner object should be created in the OwnerAddForm instead of the
I think this would be better than doing it in the parent. Either way you have
to write an add subform, which is tedious at best.
> What I moreover don't understand in the subform.txt example is why the
> OwnerAddForm is of type form.EditForm instead of e.g. form.Form and the
> CarAddForm is not form.AddForm. This would also save the redefinition of
> updateWidgets(), I think.
Because I don;t want to write an addform for subforms. The problem is that
things start to multiply.
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
More information about the Zope3-users