Hi,

it's not that easy with a custom source/vocabulary yet :(

Pointers:

1. Setting vocabulary in schema (though, there was a custom "ajax_vocabulary"-attribute instead of "vocabulary"-attribute still in p.a.widgets 1.3.2):

https://github.com/plone/plone.app.widgets/blob/master/plone/app/widgets/dx_bbb.py#L71

2. Vocabulary access requires defining a permission:

https://github.com/plone/plone.app.widgets/blob/master/plone/app/widgets/browser/vocabulary.py#L16

(We needed to inject permission for our custom vocabulary there to make it work.)

3. Vocabulary call should accept query-parameter:

https://github.com/plone/plone.app.vocabularies/blob/master/plone/app/vocabularies/catalog.py#L495

-Asko

ajung wrote:
ok, the widget now shows up. However nothing is found - neither through the
browser nor through the search tab. I see that the JSON requests to
@@getVocabulary but always zero results...digging depper now..

-aj


Asko Soukka wrote
Hi,

you should use RelatedItemsFieldWidget instead of RelatedItemsWidget
(the same naming convention applies for all z3c.form-widgets).

Regards,
Asko

Andreas Jung wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there,

I am trying to get the RelatedItemsWidget of plone.app.widgets
flying with a Dexterity 2 content-type.

I tried something like

   17 class IConversion(form.Schema):$
   18     """ Project Folder """$
   19 $
   20     form.widget(template=RelatedItemsWidget)$
   21     template = RelationChoice($
   22                     title=_(u"Template reference"),$
   23
source=ObjPathSourceBinder(object_provides=IAuthoringTemplate.__identifier__),$
   24                     required=False,$
   25                     )$

but this gives me

Traceback (innermost last):
    Module ZPublisher.Publish, line 138, in publish
    Module ZPublisher.mapply, line 77, in mapply
    Module ZPublisher.Publish, line 48, in call_object
    Module plone.z3cform.layout, line 66, in __call__
    Module plone.z3cform.layout, line 50, in update
    Module plone.dexterity.browser.add, line 112, in update
    Module plone.z3cform.fieldsets.extensible, line 59, in update
    Module plone.z3cform.patch, line 30, in GroupForm_update
    Module z3c.form.group, line 128, in update
    Module z3c.form.form, line 134, in updateWidgets
    Module z3c.form.field, line 254, in update
TypeError: __init__() takes exactly 2 arguments (3 given)

Is there some working example code how to use the RelatedItemsWidget?

Andreas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQGUBAEBAgAGBQJSXl01AAoJEADcfz7u4AZj3joLwKape1GAURXdEMo3vJ7D/3o7
St5JvBkBRMH9cIAiE2R/6AKZ+Y/YUZYtEJJxXCdNMbbySKOqAo5yJdH8PJEmw410
6SFZ4isgGbieal50Sm2fC4ulBzSajAnBU7igYYIpBeOyj0WUvlEWkceESB/F7Aku
kNYxMNjjPnHg8ZNCNRz2BpVr0fgWcbesY3oEVcDhESubEw/dORsUD9porYcAYXPp
zW2l+9+hRkJb+tXDbgWrGe7+blI2Zxql5GhZPvzd/lMdAe52A+l0NtiZX/tsTFIB
Ueiaomef18yhVqTX9kREjhB4lKZ2y7z7IE83rfraaT2sjtMcZryANgrN7i32LTko
TqQC5aT7iNO2B2WnGD5KjDIYIbwBtLZEqBAZzaMLNWEfDUfhIREAI3ca9Xihtdm3
vUj7kXLc8NhAYyNHRxMMiEGXwRYuk8fRb/w5Zyk/cncH/rUNTlbzDehl0TlI4VZ0
3wOpRqYGpj628ujgLADwlKC7+RvCWkg=
=20ji
-----END PGP SIGNATURE-----
_______________________________________________
Product-Developers mailing list


[email protected]

https://lists.plone.org/mailman/listinfo/plone-product-developers
_______________________________________________
Product-Developers mailing list

[email protected]

https://lists.plone.org/mailman/listinfo/plone-product-developers





--
View this message in context: 
http://plone.293351.n2.nabble.com/plone-app-widgets-RelatedItemsWidget-tp7568332p7568336.html
Sent from the Product Developers mailing list archive at Nabble.com.
_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/plone-product-developers
_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/plone-product-developers

Reply via email to