family: select formdefs presenting all keywords
This commit is contained in:
parent
f4808f0a33
commit
7f0dd9f035
|
@ -61,9 +61,10 @@ class FamilyInfosCell(CellBase):
|
|||
return {'family': ws_family_data}
|
||||
# get formdefs and formdata from wcs
|
||||
def add_forms(obj, formdefs, forms, drafts, id_varname):
|
||||
keywords_set = set(obj.get('keywords', []))
|
||||
obj['formdefs'] = [f for f in formdefs
|
||||
if keywords_set.intersection(f.get('keywords', []))]
|
||||
if obj.get('keywords'):
|
||||
keywords_set = set(obj['keywords'])
|
||||
obj['formdefs'] = [f for f in formdefs if f.get('keywords')
|
||||
and keywords_set.issuperset(f['keywords'])]
|
||||
if obj.get('id'):
|
||||
obj['forms'] = [f for f in forms
|
||||
if f['fields'].get(id_varname) == obj['id']]
|
||||
|
@ -80,6 +81,8 @@ class FamilyInfosCell(CellBase):
|
|||
add_forms(adult, formdefs, forms, drafts, id_varname='adult_raw')
|
||||
for child in family.get('children', []):
|
||||
add_forms(child, formdefs, forms, drafts, id_varname='child_raw')
|
||||
for contact in family.get('contacts', []):
|
||||
add_forms(contact, formdefs, forms, drafts, id_varname='contact_raw')
|
||||
context['family'] = ws_family_data
|
||||
return context
|
||||
|
||||
|
|
Loading…
Reference in New Issue