[web2py] Re: Binding a form field to a user field

2015-07-31 Thread Pablo Andrés Ortega Chávez
Thank you Anthony! That was exactly what I did last night, with a post I found here. I just replied here with some questions, so I'll have to wait for my post to be approved and published so you can see it. I'd appreciate any insights. Regards, Pablo. El viernes, 31 de julio de 2015, 12:5

[web2py] Re: Binding a form field to a user field

2015-07-31 Thread Pablo Andrés Ortega Chávez
Thank You Massimo! Yesterday after I posted my question, I found another post here and went ahead and do this: On the image table I defined: *Field('user_id', db.auth_user, default=auth.user_id, writable=False, readable=False),* And then I also defined this: *db.image.user_id.requires = IS_I

[web2py] Re: Binding a form field to a user field

2015-07-31 Thread Anthony
Using auth.signature is a good approach (though may be overkill if you don't need the other fields it creates). But for reference, to achieve what you want, just hide the user_id field and give it a default value: Field('user_id', 'reference auth_user', writable=False, default=auth.user_id ) An

[web2py] Re: Binding a form field to a user field

2015-07-31 Thread Massimo Di Pierro
Do not do this: db.define_table('image', Field('user_id', 'reference auth_user'), Field('file', 'upload'), Field('description', 'text')) do db.define_table('image', Field('file', 'upload'), Field('description', 'text