36👍
✅
Finally, after checking the SQLAlchemy doc, this should be the way:
Column('created_on', DateTime, default=datetime.datetime.now)
Column('last_updated', DateTime, onupdate=datetime.datetime.now)
doc here:
http://docs.sqlalchemy.org/en/latest/core/defaults.html#python-executed-functions
0👍
It’s still possible to use the following:
enter_date = Column(DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow)
On update also sqlalchemy set the current date at the time the data updates.
- How to Hash Django user password in Django Rest Framework?
- 'QuerySet' object has no attribute ERROR, trying to get related data on ManyToMany fields
- Problem launching docker-compose : python modules not installed
- How to add some extra fields to the page in django-cms? (in django admin panel)
Source:stackexchange.com