web/formfields.py
branchtls-sprint
changeset 1577 25b46db3cb81
parent 1574 0c6dbb774f54
child 1706 491a2ca3aaef
equal deleted inserted replaced
1576:3bfcf1e4eb26 1577:25b46db3cb81
   458             constraints = rschema.rproperty(eschema, targetschema, 'constraints')
   458             constraints = rschema.rproperty(eschema, targetschema, 'constraints')
   459             # init StringField parameters according to constraints
   459             # init StringField parameters according to constraints
   460             for cstr in constraints:
   460             for cstr in constraints:
   461                 if isinstance(cstr, StaticVocabularyConstraint):
   461                 if isinstance(cstr, StaticVocabularyConstraint):
   462                     kwargs.setdefault('widget', Select())
   462                     kwargs.setdefault('widget', Select())
       
   463                     kwargs.setdefault('choices', cstr.vocabulary)
   463                     if card in '?1':
   464                     if card in '?1':
   464                         kwargs['widget'].attrs.setdefault('size', 1)
   465                         kwargs['widget'].attrs.setdefault('size', 1)
   465                 if isinstance(cstr, SizeConstraint) and cstr.max is not None:
   466                 if isinstance(cstr, SizeConstraint) and cstr.max is not None:
   466                     if cstr.max > 257:
   467                     if cstr.max > 257:
   467                         kwargs.setdefault('widget', TextArea)
   468                         kwargs.setdefault('widget', TextArea)