[web2py] Re: Pulling user for submittions automatically

2011-06-13 Thread pbreit
Ah, ok. I think you need to put your tables at the bottom, after auth.define_tables() so that the auth_user table is created before your tables.

[web2py] Re: Pulling user for submittions automatically

2011-06-13 Thread Drise
My model file : db.define_table('image', Field('title'), Field('file', 'upload'), Field('description', 'text'), Field('date', 'datetime', default=request.now), Field('user', db.auth_user, default=auth.user_id), Field('rating', default=0)) db.define_table('comment', Field('ima

[web2py] Re: Pulling user for submittions automatically

2011-06-13 Thread pbreit
I guess that means you are not using authentication. How did you set up your application in the first place? Can you delete it and start over with a "New simple application"? If you don't want to start over, make sure you have these lines in a model file. from gluon.tools import Mail, Auth mai

[web2py] Re: Pulling user for submittions automatically

2011-06-13 Thread Drise
And I got this error when using the code you supplied Traceback (most recent call last): File "C:\Users\Drise\Desktop\web2py\gluon\restricted.py", line 188, in restricted exec ccode in environment File "C:/Users/Drise/Desktop/web2py/applications/***/models/db.py", line 15, in Field('u

[web2py] Re: Pulling user for submittions automatically

2011-06-13 Thread Drise
No I would require them to login to post. They can login at index but its not required, it only displays content. And I'll try that code in a sec, let you know. On Jun 13, 4:14 pm, pbreit wrote: > Are users logged in? Usually you do it like this: > Field('created_by', db.auth_user, default=auth.

[web2py] Re: Pulling user for submittions automatically

2011-06-13 Thread pbreit
Are users logged in? Usually you do it like this: Field('created_by', db.auth_user, default=auth.user_id) Do you allow users to inset an image without registering or logging in? If so, you may need to handle it differently, possibly with an onvalidation function that accounts for there being no