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