Re: [SQLObject] date time column default now()
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Brian R. <br...@se...> - 2004-12-13 22:53:36
|
On Dec 13, 2004, at 4:11 PM, Ian Bicking wrote: > Brian Ray wrote: >> I need help using SQLObject. I am trying to override a column >> attribute without actually sending an argument. >> Is there a way I can get a time stamp functionality out of my date >> time column default? >> ... >> from mx.DateTime import * >> class table(SQLObject): >> timestamp = DateTimeCol(default=now()) > > I think you want: > > timestamp = DateTimeCol(default=now) > > If you pass a function as the default, that function is called > immediately before actually using it Great! And I see where this concept may be useful in other places, so i added to wiki: http://wiki.sqlobject.org/timestamp.html Hope it's ok. |