fix: add tojson Jinja2 filter to fix 500 on replica detail page
All checks were successful
Deploy / deploy (push) Successful in 17s
All checks were successful
Deploy / deploy (push) Successful in 17s
FastAPI's Jinja2Templates doesn't include Flask's tojson filter. Register json.dumps as the tojson filter so replica_detail.html can safely embed replica.name in a JS string literal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -128,8 +128,10 @@ def create_app() -> FastAPI:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Templates
|
# Templates
|
||||||
|
import json as _json
|
||||||
templates_dir = Path(__file__).parent / "templates"
|
templates_dir = Path(__file__).parent / "templates"
|
||||||
templates = Jinja2Templates(directory=str(templates_dir))
|
templates = Jinja2Templates(directory=str(templates_dir))
|
||||||
|
templates.env.filters["tojson"] = _json.dumps
|
||||||
|
|
||||||
# Register UI routes (must come before API to avoid catch-all conflicts)
|
# Register UI routes (must come before API to avoid catch-all conflicts)
|
||||||
from .ui.routes import router as ui_router, setup_templates
|
from .ui.routes import router as ui_router, setup_templates
|
||||||
|
|||||||
Reference in New Issue
Block a user