also if this is just to select a supplier from the table, i'd
recommend having a look at the vocabulary framework... i put together
a really simple one for the states vocabulary in orgpeople, but you
can do more complex examples, see zope.schema/sources.txt it allows
you to bind a vocabulary to context before fetching values.
thanks i will have a closer look to it. I also have phillip's new book
now and there is a section about voabularies and sources.
so in your opinion, what would be the most sane way to have a supplier
selection (being part of a purchase requisition edit form) on a
(I would like to have a more sophisticated supplier selection where you
have a table view with search filter and possibility to create a new one)
I thought of many possibilities, probably half of it is nonsense:
- right now I have it like this (not very good solved at all): I use an
objectwidget in the purchase requisition edit, that only serves as
"display" and contains a button to the supplier container that is
acquisitioned from the mapped instance.
here I link every entry in the table with a link like
Here I would like to assign prinstance.supplier = thissupplier, but of
course thissupplier not provides IObject (Objectwidget) which leads to
an error. direct db update here is nonsense because I want the update
only when the complete transaction of the predit form is
saved............so its a one way.
-----> I can see clearly that this is nonsence, because I am not
correctly using the schema, the "supplier" relation has to be a IChoice
and not an IObject. Maybe it is also nonsence to have the business logic
in the __call__ method of @@selectthissupplier view, I would like to
have an action here but I think if you render the table with zc.table it
is not possible to have an action for every single row, is it?
- so it would be possible to take the ItemsWidgetBase (already contains
a vocabulary) and build a custom view upon that shows the details of the
currently selected supplier and offers a button "supplier select" to the
table view. However,
I think it is difficult to have the table view updating the parent edit
form. Actually when the table view is an independent view it is not a
parent form at all, I have to do the updates manually, in addition to
that the previously entered request data will probably be lost when I
dont pass it manually.
- probably the best option is, I recently thought, is to pack the table
selection view into a somehow modified "sequence selection widget", that
has a source / vocabulary having all action happening same form but only
show this widget and hide everything else.
so we would achieve to have all previously entered data on the edit form
still in the request easily and have a true parent form - child form
Zope3-users mailing list