[Grok-dev] Add forms - one object type to multiple object types

Darryl Cousins darryl at darrylcousins.net.nz
Sat Mar 10 18:45:05 EST 2007


Hi,

I'm trying out a simple site type app with grok.

I've 3 content types: Site, Section and Page. Add form for page begins::

class Add(grok.AddForm):
	grok.context(Site)
	grok.name('addpage')

So now I can add pages to Sites. But I want also to add them to
Sections. So the Add class needs a different context:
grok.context(Section).

It seems that I need to make a new add class in order to do so, one for
Site and the other for Section.

Using zcml I would have been able to register the add class for both
Sites and Sections. Here (as I see from my low stand point) it seems not
so straight forward.

Thoughts?

Kind regards,
Darryl



More information about the Grok-dev mailing list