Hi,

How to use creatargs in SQLFORM.grid?

Table:
Objeto = db.define_table('objeto',
      SQLField('almoxarifado_id', db.almoxarifado, notnull=True, 
readable=True, writable=True, label='Almoxarifado'),
      SQLField('nome', 'string', length='50', notnull=True, label='Nome'),
      SQLField('quantidade', 'integer', notnull=True, default=0),
      SQLField('localizacao', 'string', length='50', label='Localização'),
      SQLField('obs', 'text', label='Especificação'))
Objeto.almoxarifado_id.requires=IS_IN_DB(db, 'almoxarifado.id', '%(nome)s')

def index():
    alm = request.args(0) or redirect(URL('almoxarifado','index'))
    form = SQLFORM.grid(Objeto.almoxarifado_id == alm, fields=[Objeto.nome, 
Objeto.quantidade, Objeto.localizacao], 
createargs={'Objeto.almoxarifado_id':alm}, user_signature=False, csv=False)
    return dict(form=form)

I try create new record with field Objeto.almoxarifado_id = args(0), to 
hide this field in form.

Thanks in advance,

Fabiano.

-- 
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