[web2py] Re: Help with picture default

2010-11-07 Thread CesarBustios
Thanks a lot! I'll try both :) On Nov 6, 3:25 pm, Branko Vukelic wrote: > On Sat, Nov 6, 2010 at 7:32 AM, CesarBustios wrote: > > Hi, please in my database i have an 'upload' type Field and i want to > > make some picture ('pic.jpg') the default picture when the form load, > > how can i do that?

[web2py] Re: Help with picture default

2010-11-06 Thread mdipierro
My mistake... this is a little more complex than I thought because it depends on the workflow. There are two options: 1) if the user does not set an image you get a default one assuming : db.define_table('mytable', Field('picture','upload')) and assuming: form=crud.create(db.mytable) you can do:

[web2py] Re: Help with picture default

2010-11-06 Thread CesarBustios
Oh no it's not working! =( On 6 nov, 08:39, CesarBustios wrote: > Thanks a lot Mr. Massimo you save my life :) I love web2py by the > way! > > On 6 nov, 02:41, mdipierro wrote: > > > > > This should do it. > > > db.define_table('mytable', Field('picture','upload')) > > > db.mytable.picture.

[web2py] Re: Help with picture default

2010-11-06 Thread CesarBustios
Thanks a lot Mr. Massimo you save my life :) I love web2py by the way! On 6 nov, 02:41, mdipierro wrote: > This should do it. > > db.define_table('mytable', Field('picture','upload')) > > db.mytable.picture.default=lambda:db.mytable.picture.store(open('path/ > pic.jpg','rb')) > > On Nov 6, 1

[web2py] Re: Help with picture default

2010-11-06 Thread mdipierro
This should do it. db.define_table('mytable', Field('picture','upload')) db.mytable.picture.default=lambda:db.mytable.picture.store(open('path/ pic.jpg','rb')) On Nov 6, 1:32 am, CesarBustios wrote: > Hi, please in my database i have an 'upload' type Field and i want to > make some picture ('p