You could do:

for field in db.mytable:
     field.default=somevalue
db.mytable.insert()

However why would you want to do this?

On Sunday, 29 April 2012 08:08:44 UTC+1, rahulserver wrote:
>
> The insert function in web2py expects db.tablename.insert(...) with column 
> name and value pairs. What if the table has lengthy field names and i wish 
> to insert in the table by iterating through all the fields.
> I tried:
>
> for field in db[db.MyTable]:
>                  nme='\''+field.name+'\''
>                  db.Account_Master.insert(nme='somevalue')
>
> It is giving me error as:
> <type 'exceptions.SyntaxError'> Field nme does not belong to the table
>
> When i try field.name instead of nme, editor does not let me save and 
> gives error as:
>
> keyword can't be an expression 
>
>

Reply via email to