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 <module>
Field('user', db.auth_user, default=auth.user_id),
File "C:\Users\Drise\Desktop\web2py\gluon\dal.py", line 3990, in
__getattr__
return self[key]
File "C:\Users\Drise\Desktop\web2py\gluon\dal.py", line 3984, in
__getitem__
return dict.__getitem__(self, str(key))
KeyError: 'auth_user'
On Jun 13, 4:29 pm, Drise <[email protected]> wrote:
> 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 <[email protected]> wrote:
>
>
>
>
>
>
>
> > 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 user.