[simplified ui] Use custom form renderer for data object reference in a simplified profile
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 21 Jul 2016 15:05:12 +0200
changeset 1489 c6a82e112fdf
parent 1488 88e99aa4886a
child 1490 e59235e603cf
[simplified ui] Use custom form renderer for data object reference in a simplified profile This completes the previous cset which add basic rtags, by including a single form instead of 'add' links. This form has no visible fields so nothing is displayed with the help of the proper inlined form renderer. Related to #14066262
views/archiveunit.py
--- a/views/archiveunit.py	Thu Jul 21 14:51:55 2016 +0200
+++ b/views/archiveunit.py	Thu Jul 21 15:05:12 2016 +0200
@@ -341,3 +341,18 @@
 do_ref_afs.tag_attribute(
     ('SEDADataObjectReference', 'user_cardinality'),
     'inlined', 'hidden')
+
+
+class DataObjectSimplifiedAutomaticEntityForm(widgets.SimplifiedAutomaticEntityForm):
+    __select__ = (widgets.SimplifiedAutomaticEntityForm.__select__
+                  & is_instance('SEDABinaryDataObject', 'SEDAPhysicalDataObject')
+                  & simplified_profile())
+
+
+class DataObjectReferenceNoTitleEntityInlinedFormRenderer(widgets.NoTitleEntityInlinedFormRenderer):
+    """Don't display any title nor remove link for DataObjectReference in the context of a
+    simplified profile.
+    """
+    __select__ = (widgets.NoTitleEntityInlinedFormRenderer.__select__
+                  & is_instance('SEDADataObjectReference')
+                  & simplified_profile())