cubicweb #1799997 creation form field vocabulary improvement using __linkto infos [resolved]
__linkto provided informations can be used to further refine creation form vocabulary. Example based on the following schema:
class works_in(RelationDefinition): subject = 'CWUser' object = 'Lab' cardinality = '1*' constraints = [RQLConstraint('S in_group G, O welcomes G')] class welcomes(RelationDefinition): subject = 'Lab' object = 'CWGroup'
If we create a CWUser in the "scientists" CWGroup (using __linkto=ingroup:XXX:subject where XXX is the group eid), only the labs that welcome them should be proposed in the "works_in" selection widget.
A string-based implementation was performed in the Pylos project, but since this ticket is now implemented, it can be ported and improved, using the syntax tree used in entity.py "unrelated" method.
|closed by||#64639bc94e25 [entity] restrict creation form field vocabulary using __linkto information (closes #1799997)|