addressing justcool393 comments
This commit is contained in:
parent
1e7a3d81b6
commit
57f6470c36
3 changed files with 22 additions and 17 deletions
|
@ -4,6 +4,7 @@ from datetime import datetime, timedelta, timezone
|
|||
from sqlalchemy import text
|
||||
from sqlalchemy.orm import declarative_base, declared_attr
|
||||
from sqlalchemy.schema import Column
|
||||
from sqlalchemy.sql.functions import now
|
||||
from sqlalchemy.sql.sqltypes import Integer, DateTime
|
||||
|
||||
from files.helpers.time import format_age, format_datetime
|
||||
|
@ -72,7 +73,7 @@ class CreatedDateTimeBase(Base):
|
|||
|
||||
Retrieving `created_datetimez` will return a `datetime` object with `tzinfo` for UTC.
|
||||
"""
|
||||
return Column(DateTime(timezone=True), nullable=False, server_default=text("now()"))
|
||||
return Column(DateTime(timezone=True), nullable=False, server_default=now())
|
||||
|
||||
@property
|
||||
def created_utc(self):
|
||||
|
@ -124,4 +125,4 @@ class CreatedDateTimeBase(Base):
|
|||
"""
|
||||
a string representing time since created. Example: "1h ago", "2d ago".
|
||||
"""
|
||||
return format_age(self.created_datetimez)
|
||||
return format_age(self.created_datetimez)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue