Makign corrections on field selection.

This commit is contained in:
Yaro Kasear 2025-09-09 16:27:41 -05:00
parent 7e915423a3
commit 9d36d600bb
9 changed files with 1504 additions and 39 deletions

View file

@ -1,10 +1,30 @@
from flask import Blueprint, request, jsonify, render_template
from flask import Blueprint, current_app, render_template, send_file
from pathlib import Path
from crudkit.core.service import CRUDService
from crudkit.core.spec import CRUDSpec
from crudkit.ui.fragments import render_table
from ..db import get_session
from ..models.work_log import WorkLog
bp_index = Blueprint("index", __name__)
def init_index_routes(app):
@bp_index.get("/")
def index():
return render_template("base.html")
session = get_session()
work_log_service = CRUDService(WorkLog, session)
work_logs = work_log_service.list({"complete__ne": 1, "fields": ["start_time"]})
print(work_logs)
logs = render_table(work_logs)
return render_template("index.html", logs=logs)
@bp_index.get("/LICENSE")
def license():
path = Path(current_app.root_path).parent / "LICENSE"
return send_file(path, mimetype="text/plain; charset=utf-8")
app.register_blueprint(bp_index)