web/formfields.py
changeset 4044 3876c894e018
parent 4023 eae23c40627a
child 4069 5d149ba65dd0
equal deleted inserted replaced
4043:39ae94e0c8b8 4044:3876c894e018
   592             def get_default(form, es=eschema, rs=rschema):
   592             def get_default(form, es=eschema, rs=rschema):
   593                 return es.default(rs)
   593                 return es.default(rs)
   594             kwargs.setdefault('initial', get_default)
   594             kwargs.setdefault('initial', get_default)
   595     else:
   595     else:
   596         targetschema = rdef.subject
   596         targetschema = rdef.subject
   597     kwargs['required'] = rdef.role_cardinality(role) in '1+'
   597     card = rdef.role_cardinality(role)
       
   598     kwargs['required'] = card in '1+'
   598     kwargs['name'] = rschema.type
   599     kwargs['name'] = rschema.type
   599     if role == 'object':
   600     if role == 'object':
   600         kwargs.setdefault('label', (eschema.type, rschema.type + '_object'))
   601         kwargs.setdefault('label', (eschema.type, rschema.type + '_object'))
   601     else:
   602     else:
   602         kwargs.setdefault('label', (eschema.type, rschema.type))
   603         kwargs.setdefault('label', (eschema.type, rschema.type))