In my application I defined the following tables:

db.define_table('module',
    
Field('name',length=32,default='',requires=[IS_LENGTH(32,error_message='lengte 
overschreidt 32 
tekens'),IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'module.name',error_message='module 
al in database')],notnull=True,unique=True),
    format='%(id)s', 
    migrate=False)

db.define_table('subscribe',
    Field('nodeID','reference node'),
    Field('viewID','reference view'),
    Field('moduleID',type='list:reference module'),
    ...
    migrate=False)

When a user registers, he can choose between three views: a 
zero_module_view, a one_module_view and a n_module_view

Which results in the following values in the field subscribe.moduleID:

None
2
1,2,3

In the function in which I process the subscriptions I retrieve a row from 
the subscribe table:

row=db().select().first()

Based on the value of viewID and moduleID I insert records into several 
tables. The problem is I do not know
how to deal with row.moduleID to make the correct inserts.

for m in row.moduleID:
    if m==1:
        # insert
    elif m==2:
        # insert
    elif m==3:
        # insert

... or isn't this going to work?


Furthermore, in case of a one_module_view I'd like the input to be radio 
buttons and in case of a n_module_view check boxes,
at the moment it's a drop box.


Kind regards,

Annet

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to