El 25 de junio de 2010 23:01, ClaudioCaviglia
<[email protected]>escribió:

>
> Hola a todos,
>
> Estoy intentando agregar un ReferenceField a mi content type pero quiero
> aplicar un filtro para mostrar solo aquellos contenidos referenciables que
> poseean un atributo con un valor determinado. He intentado utilizar indices
> pero no puedo resolverlo.
>
>
base_query:

"Defines query terms that will apply to all searches, mainly useful to
create specific restrictions when allow_browse=0. Can be either a dictonary
with query parameters, or the name of a method or callable available in
cotext that will return such a dictionary." [0]


Mira este ejemplo [1]:

    RelationField(
        name='departments',
        widget=ReferenceBrowserWidget(
            label=u'Departments',
            label_msgid='FacultyStaffDirectory_label_departments',
            i18n_domain='FacultyStaffDirectory',
            base_query={'portal_type': 'FSDDepartment', 'sort_on':
'sortable_title'},
            allow_browse=0,
            allow_search=1,
            show_results_without_query=1,
        ),
        write_permission=ASSIGN_DEPARTMENTS_TO_PEOPLE,
        schemata="Basic Information",
        allowed_types=('FSDDepartment'),
        multiValued=True,
        relationship='DepartmentalMembership'
    ),


Espero que sea eso y de utilidad para ti.

[0]
http://plone.org/documentation/manual/developer-manual/archetypes/fields/widgets-reference#ReferenceBrowserWidget

[1] Lo saque de un producto bien conocido, FSD : http://tinyurl.com/2fwg5gm

Saludos

-- 

Rubén Hidalgo Soto
_______________________________________________
Plone-ConoSur mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/plone-conosur

Responder a