Commit 08c41999 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[ui] URI cardinality is 1 when used as alternative of a binary data object

so handle this by a custom vocabulary function.
parent 96f59a98104a
......@@ -91,6 +91,23 @@ class ContainedSearchForRelatedEntitiesView(rwdg.SearchForRelatedEntitiesView):
return self._cw.execute(rql, {'at': int(self._cw.form['container'])})
def uri_cardinality_vocabulary(form, field):
req = form._cw
# inlined creation form
parent_type = json.loads(req.form['arg'][1])
except KeyError:
# edition through reledit
parent_eid = req.form['eid']
parent_type = req.describe(int(parent_eid))[0]
if parent_type in ('SEDABinaryDataObject', 'SEDAAltBinaryDataObjectAttachment'):
return [u'1']
return [u'0..1', u'1']
affk.tag_attribute(('SEDAUri', 'user_cardinality'),
{'choices': uri_cardinality_vocabulary})
for key, rql_expr in RDEF_CONSTRAINTS.items():
if 'S container AT' in rql_expr:
Markdown is supported
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