[Product-Developers] problem about atapi.ReferenceField in contentXX.py and schema.Object in interfaces.py

柯铁军 mujinjun at ysu.edu.cn
Fri Nov 14 09:49:40 UTC 2008


These days i wanna design a product for business reservation via Plone3.
I designed three content types like BizReservationFolder, BizReservation, BizReply.
In a BizReservationFolder, any anonymous user can add a BizReservation, then logined user can add a BizReply.
I thought i could use the code in bizreservation.py like below:
bizreply = schema.Object(title=_(u"Business Reply"),
			    required=False,
			    schema=IBizReply)
to ensure one BizReply to correspond to one BizReservation.
But through the code in interfaces.py like:
atapi.ReferenceField('bizreply',
        required=False,
        stroage=atapi.AnnotationStorage(),
        multiValued=True,
        relationship="business_has_reply",
        allowed_types=('BizReply',),
        widget=ReferenceBrowserWidget(label=_(u"Business Reply"),
                                      description=_(u""),
                                      addable=True,
                                      restrict_browsing_to_startup_directory=True,
                                      )
        ),
which i learned from the codes in internet, i doubted whether i could keep the correspondence which i wanted.

At the beginning, i put all the elements in BizReply into the BizReservation. But i need some information such as the customer's service details to be protected from anonymous and only part of the information to be inputed by the anonymous while the other information to be inputed by the logined user.So I divided it into two content types.

And now, I'm not sure whether there are some errors in my design or there are other better way to achieve my purpose.
Thanks for any reply:P

 





More information about the Product-Developers mailing list