This sounds crazy but I'm getting an error 404 when using in the same function this lines together:
test = db.test(request.args(0,cast=int, otherwise=URL('index'))) or redirect(URL('index'))
grid = SQLFORM.grid(db(
db.test.id == 2), deletable=False, editable=True)
When I comment either one of the lines, the function returns the correct values for test and grid. When put together, it doesn't work and I get redirected or a 404 error.
the complete escenario is:
Request:
Model:
db.define_table('test',
Field('nombre', 'string', unique=True, label='Nombre'),
Field('gerencia', label='Gerencia'),
Field('equipo', label='Equipo'),
Field('vigencia', 'date', label='Vigencia'),
format = '%(nombre)s'
)
Controler:
@auth.requires_login()
def testArg():
test = db.test(request.args(0,cast=int, otherwise=URL('index'))) or redirect(URL('index'))
grid = SQLFORM.grid(db(
db.test.id == 2))#, deletable=False, editable=True)
return locals()
View:
generic.html
Am I missing something really obvious?
David.