you just should not do this:

Field(...,default=request.args(0))

in models.

You can do (as a workaround)

if request.args:
   db.table.field.default=request.args(0)

but I still would not do it this way. Instead do in the controller
where you need it:

def myaction():
    db.table.field.default=request.args(0)
    form = SQLFORM(db.table,...)

On Nov 30, 1:17 am, lyn2py <[email protected]> wrote:
> If I have:
>
> #model
> db.define_table('mytable',
>   ...
>   Field('other_table_id','reference
> other_table',default=request.args(0),...),
>   ...
> )
>
> It works fine on the webpage (Views) and SQLFORM, but when I try to
> access the database from appadmin, it runs into an error:>> ValueError: 
> invalid literal for int() with base 10: 'db'
>
> because the first item is "db" and it's not an integer.
>
> Normally we will put:>> Field('other_table_id','reference 
> other_table',default=db.other_table.id,...)
>
> which will load fine, but on the webpage (Views), "None" comes up,
> which is not desirable.
>
> The only way I can think up is to use Try...Except... but syntax
> errors come up.
> How will you resolve this?
>
> Thanks!

Reply via email to