[Zope3-Users] Newbie relationship question
alga at pov.lt
Wed Jul 26 13:49:11 EDT 2006
On Wed, Jul 26, 2006 at 06:33:50PM +0200, Carlo Cardelli wrote:
> class IInvoice(Interface):
> invRef = Int(
> description=u"Invoice reference number",
> invDate = Date(
> description=u"Invoice Date",
> invCust = Object(
> ... other ininfluent fields...
> Now, I have to render the 'invCust' object as a selection-list showing
> the custNames of all possible Customers, where the user can select the
> appropriate Customer for the Invoice. Editing the Invoice, the
> selection-list should position itself showing the Customer set previously.
> In other words, I need a widget that somewhat behave like
> I know that this is a very basic problem. Anyone already implemented it?
What you need to do is define the customer field as a choice in the interface:
invCust = Choice(title=u"Customer",
and define the "Customers" vocabulary, that will list all customers in
your app. Look at zope.schema.vocabulary.SimpleVocabulary.
More information about the Zope3-users