Add default date_created field in auth_user?

4 views
Skip to first unread message
is duplicateview conversation

Brendan Hayward

unread,
Feb 15, 2015, 11:34:40 PM2/15/15
to web2py-d...@googlegroups.com
I wanted to submit a patch, but I thought I'd ask first.

I looked around for previous discussion, this was the closest to what I've done: https://groups.google.com/d/topic/web2py/M8vXPX6rExU/discussion.

It would be nice to have the date created field by default, it's one of the first things I look at when dealing with users, customers etc on any platform, not just web2py sites.

Currently I've done this in my model:

auth.settings.extra_fields['auth_user'] = [Field( 'time_stamp', type='datetime', default=request.now )]

But can this Field be declared in Auth.define_tables() instead? I've tried this and it works fine (apache on linux):

Field('date_created', type='datetime', default=datetime.datetime.utcnow()),



Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages