|
|
@ -1,4 +1,5 @@ |
|
|
|
from datetime import datetime |
|
|
|
from zoneinfo import ZoneInfo |
|
|
|
|
|
|
|
from app import db |
|
|
|
from models.postmodel import Post |
|
|
@ -9,10 +10,13 @@ from sqlalchemy.exc import (DatabaseError, DataError, IntegrityError, |
|
|
|
def schedule_text(request): |
|
|
|
print(request.form["text"]) |
|
|
|
try: |
|
|
|
text = request.form["text"] |
|
|
|
content = f"<p>{text}</p>" |
|
|
|
zoneinfo = ZoneInfo("Europe/Berlin") |
|
|
|
post = Post( |
|
|
|
content=request.form["text"], |
|
|
|
last_updated=datetime.now(), |
|
|
|
scheduled_time=datetime.now(), |
|
|
|
content=content, |
|
|
|
last_updated=datetime.now().astimezone(tz=zoneinfo), |
|
|
|
scheduled_time=datetime.now().astimezone(tz=zoneinfo), |
|
|
|
) |
|
|
|
db.session.add(post) |
|
|
|
db.session.commit() |
|
|
|