try timezones
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from auth.authenticate import login_required
|
||||
from base.orm import local_session
|
||||
@@ -37,7 +37,7 @@ async def invite_author(_, info, author, shout):
|
||||
if author.id in authors:
|
||||
return {"error": "already added"}
|
||||
shout.authors.append(author)
|
||||
shout.updated_at = datetime.now()
|
||||
shout.updated_at = datetime.now(tz=timezone.utc)
|
||||
session.add(shout)
|
||||
session.commit()
|
||||
|
||||
@@ -63,7 +63,7 @@ async def remove_author(_, info, author, shout):
|
||||
if author.id not in authors:
|
||||
return {"error": "not in authors"}
|
||||
shout.authors.remove(author)
|
||||
shout.updated_at = datetime.now()
|
||||
shout.updated_at = datetime.now(tz=timezone.utc)
|
||||
session.add(shout)
|
||||
session.commit()
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from auth.authenticate import login_required
|
||||
from base.orm import local_session
|
||||
@@ -71,7 +71,7 @@ async def update_shout(_, info, inp):
|
||||
return {"error": "access denied"}
|
||||
else:
|
||||
shout.update(inp)
|
||||
shout.updatedAt = datetime.now()
|
||||
shout.updatedAt = datetime.now(tz=timezone.utc)
|
||||
session.add(shout)
|
||||
if inp.get("topics"):
|
||||
# remove old links
|
||||
@@ -103,7 +103,7 @@ async def delete_shout(_, info, slug):
|
||||
return {"error": "access denied"}
|
||||
for a in authors:
|
||||
reactions_unfollow(a.slug, slug, True)
|
||||
shout.deletedAt = datetime.now()
|
||||
shout.deletedAt = datetime.now(tz=timezone.utc)
|
||||
session.add(shout)
|
||||
session.commit()
|
||||
|
||||
|
Reference in New Issue
Block a user