<offtopic>mantra for users seeking help .... post a working model, post a 
working model, post a working model</offtopic>

db.define_table('analyses',
    Field('info'),
    Field('status'), 
    format='%(info)s')
db.define_table('samples',
    Field('analyses_id', 'reference analyses'),
    Field('sample_info')
    )

you have to manage it at the beginning....something like 

def test():
    create = True
    if request.args(1) == 'samples.analyses_id':
        if db.analyses(request.args(2)).status == 'Submitted':
            create = False
    grid=SQLFORM.smartgrid(db.analyses,linked_tables=['samples'], create=
create)
    return dict(grid=grid)



On Monday, January 14, 2013 9:07:58 PM UTC+1, Kostas M wrote:
>
> Thanks for the clarification.
>
> In my case, I have two tables:
>
>
> db.define_table('analyses',Field('info'),Field('status')
> db.define_table('samples',db.analyses,Field('sample_info')
>
>
> and I use:
>
> grid=SQLFORM.smartgrid(db.analyses,linked_tables=['samples'])
>
> I want when the status of an Analysis is 'Submitted', the user to
> not be able to create new, edit, or delete the submitted samples of an
> Analysis. So,I am using the callback functions for the SQLFORM.smartgrid 
> options of
>
> editable and deletable, to control these options, eg:
>
> deletable=dict(analyses=is_open, samples=is_open),
>
> Since create is not a callback,
> how, could I control whether the 'Add' button at Samples should be 
> available,
> only if the parent Analysis has not yet been submitted?
>
>

-- 



Reply via email to