Apr 1 2026: clean up code

This commit is contained in:
2026-04-01 13:15:05 -04:00
parent f399537246
commit 093d3a0043
11 changed files with 52 additions and 29 deletions
+4 -7
View File
@@ -2,6 +2,7 @@ import logging
from datetime import datetime, timedelta
from flask import Blueprint, render_template, request, redirect, url_for, flash
from flask_login import login_required
from app import db
from app.models.audit import AuditLog
from app.models.user import User
from app.utils.decorators import admin_required
@@ -55,13 +56,13 @@ def index():
# Distinct action and entity_type values for the filter dropdowns
distinct_actions = (
db.session.query(AuditLog.action)
AuditLog.query.with_entities(AuditLog.action)
.distinct()
.order_by(AuditLog.action)
.all()
)
distinct_entity_types = (
db.session.query(AuditLog.entity_type)
AuditLog.query.with_entities(AuditLog.entity_type)
.distinct()
.order_by(AuditLog.entity_type)
.all()
@@ -144,8 +145,4 @@ def purge():
f'older than {label} have been permanently deleted.',
'success' if deleted else 'info',
)
return redirect(url_for('audit.index'))
# Avoid circular import — imported after function definitions
from app import db # noqa: E402
return redirect(url_for('audit.index'))