[saem-devel] [PATCH 08 of 10] [eac] Use relation widget for association/hierarchical/chronological relations from/to

Sylvain Thenault sylvain.thenault at logilab.fr
Tue Jan 31 09:49:13 CET 2017

# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1485812135 -3600
#      Mon Jan 30 22:35:35 2017 +0100
# Node ID 990aaa03df44bd390cb32a9d32a161d887e2a427
# Parent  7fd7874eb24a41cd82b22fa62f5d4e8468bdb7ac
[eac] Use relation widget for association/hierarchical/chronological relations from/to

else the creation/edition form takes age to display when there are a lot of
authority record (~ 3000 in the demo).

diff --git a/cubicweb_saem_ref/views/authorityrecord.py b/cubicweb_saem_ref/views/authorityrecord.py
--- a/cubicweb_saem_ref/views/authorityrecord.py
+++ b/cubicweb_saem_ref/views/authorityrecord.py
@@ -26,10 +26,12 @@ from cubicweb.uilib import cut, js
 from cubicweb.view import EntityView
 from cubicweb.predicates import adaptable, has_related_entities, is_instance, match_kwargs
 from cubicweb.web import formfields as ff, formwidgets as fw
 from cubicweb.web.views import tabs, uicfg
+from cubes.relationwidget import views as rwdg
 from .. import cwuri_url, user_has_authority
 from . import (ImportEntityComponent, RelatedEntitiesListView, SubviewsTabView,
                RelationInfo, editlinks, external_link)
 from .widgets import JQueryIncompleteDatePicker, ConceptAutoCompleteWidget
@@ -49,10 +51,16 @@ for etype in ('AuthorityRecord',
     affk.set_field_kwargs(etype, 'end_date',
+for rtype in ('chronological_predecessor', 'chronological_successor',
+              'hierarchical_parent', 'hierarchical_child',
+              'association_from', 'association_to'):
+    affk.tag_subject_of(('*', rtype, '*'),
+                        {'widget': rwdg.RelationFacetWidget(dialog_options={'width': 800})})
 class EACImportComponent(ImportEntityComponent):
     """Component with a link to import an authority record from an EAC-CPF file."""
     __select__ = (ImportEntityComponent.__select__
                   & is_instance('AuthorityRecord')

More information about the saem-devel mailing list