Commit 75fb9672 authored by Vincent Michel's avatar Vincent Michel
Browse files

[views] Add an option to hide undefined value, even with edit permissions, closes #4094581

parent 27ecd0d83b47
......@@ -34,6 +34,7 @@ from cubicweb import NoSelectableObject
###############################################################################
class BrainomicsPrimaryView(PrimaryView):
""" Redefine primary view for html customization """
hide_undefined_value = False
def render_entity_attributes(self, entity):
"""Renders all attributes and relations in the 'attributes' section.
......@@ -42,6 +43,9 @@ class BrainomicsPrimaryView(PrimaryView):
for rschema, _, role, dispctrl in self._section_def(entity, 'attributes'):
vid = dispctrl.get('vid', 'reledit')
if rschema.final or vid == 'reledit' or dispctrl.get('rtypevid'):
if (rschema.final and self.hide_undefined_value
and getattr(entity, rschema.type, None) is None):
continue
value = entity.view(vid, rtype=rschema.type, role=role,
initargs={'dispctrl': dispctrl})
else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment