Take current welcome app & add this to the bottom of models/db.py:

# Reusable author fields
authorstamp = db.Table(None, 'authorstamp',
            Field('created_by', db.auth_user,
                          readable=False, # Enable when needed, not by
default
                          writable=False,
                          default=session.auth.user.id if
auth.is_logged_in() else 0,
                          represent = lambda id: (id and [db
(db.auth_user.id==id).select()[0].first_name] or ["None"])[0],
                          ondelete='RESTRICT'),
            Field('modified_by', db.auth_user,
                          readable=False, # Enable when needed, not by
default
                          writable=False,
                          default=session.auth.user.id if
auth.is_logged_in() else 0,
                          update=session.auth.user.id if
auth.is_logged_in() else 0,
                          represent = lambda id: (id and [db
(db.auth_user.id==id).select()[0].first_name] or ["None"])[0],
                          ondelete='RESTRICT')
            )

Errors with:
  File "C:\Bin\web2py\gluon\sql.py", line 1501, in __init__
    field.requires = sqlhtml_validators(field)
  File "C:\Bin\web2py\gluon\sql.py", line 449, in sqlhtml_validators
    referenced = field._db[field_type[10:]]
TypeError: 'NoneType' object is unsubscriptable

It's like db.auth_user doesn't exist yet!?

Many thanks,
Fran.

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to