feat: switch all timezone naive datetimes to timezone aware

This commit is contained in:
Iain Learmonth 2024-12-06 16:08:48 +00:00
parent 41fc0a73a5
commit e22abb383c
30 changed files with 322 additions and 226 deletions

View file

@ -1,16 +1,16 @@
from datetime import datetime
from datetime import datetime, timezone
from typing import Optional
from flask import render_template, flash, Response, Blueprint, current_app
from flask import Blueprint, Response, current_app, flash, render_template
from flask.typing import ResponseReturnValue
from flask_wtf import FlaskForm
from sqlalchemy import exc, desc
from wtforms import SubmitField, BooleanField
from sqlalchemy import desc, exc
from wtforms import BooleanField, SubmitField
from app.extensions import db
from app.models.automation import Automation, AutomationLogs
from app.models.tfstate import TerraformState
from app.portal.util import view_lifecycle, response_404
from app.portal.util import response_404, view_lifecycle
bp = Blueprint("automation", __name__)
@ -54,7 +54,7 @@ def automation_edit(automation_id: int) -> ResponseReturnValue:
form = EditAutomationForm(enabled=automation.enabled)
if form.validate_on_submit():
automation.enabled = form.enabled.data
automation.updated = datetime.utcnow()
automation.updated = datetime.now(tz=timezone.utc)
try:
db.session.commit()
flash("Saved changes to bridge configuration.", "success")