[web2py] Re: looping through fields & updating

2011-07-12 Thread mart
Tried Denes's suggestion, and resulrs are perect! Thanks Denes! did this: id=db.local_user.insert(dateTime=datetime.now()) rec=db(db.local_user.id==id) for key,value in localUserDict.items(): if key in db.local_user.fields:rec.update(**{key:value}) db.c

[web2py] Re: looping through fields & updating

2011-07-11 Thread mart
Will this day ever end!? ;) Thanks David, will have a look at that too! :) Thanks, Mart :) On Jul 11, 10:50 am, "David J." wrote: > You may want to look at the _filter_fields > > Look at web2py slices; this way you can pass a dict and it updates with > the relevant fields/ > > On 7/11/11 10:38

Re: [web2py] Re: looping through fields & updating

2011-07-11 Thread David J.
You may want to look at the _filter_fields Look at web2py slices; this way you can pass a dict and it updates with the relevant fields/ On 7/11/11 10:38 AM, mart wrote: Hi Denes, Thanks for the great explanation! now, its making sense to me!! I'll apply the changes below Thanks :) Mart :)

[web2py] Re: looping through fields & updating

2011-07-11 Thread mart
Hi Denes, Thanks for the great explanation! now, its making sense to me!! I'll apply the changes below Thanks :) Mart :) On Jul 11, 9:34 am, DenesL wrote: > Hi Mart, > > to be able to use the key in the update you have to pass it in a dict. > I would do: > > id=db.local_user.insert(dateTime=d

[web2py] Re: looping through fields & updating

2011-07-11 Thread DenesL
Hi Mart, to be able to use the key in the update you have to pass it in a dict. I would do: id=db.local_user.insert(dateTime=datetime.now()) # you seem to be updating one rec only rec = db(db.local_user.id==id) for key,value in localUserDict.items(): if key in db.local_user.fields: rec.upda