[web/views] display unique composite entities in deleteconf
When the entity has two relations to the same composite, display it only once.
--- a/cubicweb/web/views/editforms.py Thu Mar 23 11:47:59 2017 +0100
+++ b/cubicweb/web/views/editforms.py Thu Mar 23 12:09:59 2017 +0100
@@ -76,13 +76,16 @@
show_composite_skip_rtypes = set('wf_info_for',)
def _iter_composite_entities(self, entity, limit=None):
+ eids = set()
for rdef, role in entity.e_schema.composite_rdef_roles:
if rdef.rtype in self.show_composite_skip_rtypes:
continue
for centity in entity.related(
rdef.rtype, role, limit=limit
).entities():
- yield centity
+ if centity.eid not in eids:
+ eids.add(centity.eid)
+ yield centity
def call(self, onsubmit=None):
"""ask for confirmation before real deletion"""