Hi, I have a model like this:

db.registro_donazioni(
   Field('cognome', 'string', length=100),
   Field('nome', 'string', length=100),
   Field('gruppo_sanguigno', 'integer'),
   Field('fattore_rh', 'integer'),
   Field('sierologia', 'list:integer', label='Sierologia')
)

gruppo_sanguigno_set = {0: 'A', 1: 'B', 2: 'AB', 3: '0'}
db.registro_donazioni.gruppo_sanguigno.requires = IS_IN_SET(
gruppo_sanguigno_set)
db.registro_donazioni.gruppo_sanguigno.represent = lambda value, row: 
gruppo_sanguigno_set.get(value, None)
fattore_rh_set = {0: 'Positivo', 1: 'Negativo'}
db.registro_donazioni.fattore_rh.requires = IS_IN_SET(fattore_rh_set)
db.registro_donazioni.fattore_rh.represent = lambda value, row: 
fattore_rh_set.get(value, None)
db.registro_donazioni.sierologia.requires = IS_IN_SET({0: 'HIV', 1: 'HCV', 2
: 'HBV'}, multiple=True)
db.registro_donazioni.sierologia.widget = lambda field, value: SQLFORM.
widgets.checkboxes.widget(field, value, cols=3, style='table')

When viewing a record in read-only (SQLFORM(db.registro_donazioni, record, 
readonly=True)) the 'sierologia' is displayed as a list of values instead 
of multiple checkboxes. I think I need to set the ".represent" attribute of 
the field, but I don't know how to do it. Some help please?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to