diff --git a/web/app.py b/web/app.py index 4d3622f..be2c471 100644 --- a/web/app.py +++ b/web/app.py @@ -8,6 +8,7 @@ import secrets import sqlite3 from datetime import datetime from pathlib import Path +from urllib.parse import quote import markdown as md_lib from fastapi import FastAPI, Form, HTTPException, Request, Response @@ -250,9 +251,17 @@ def candidates(request: Request, direction: str = "", status: str = "", own: str continue break conn.close() + # строка параметров фильтров для ссылок (выбор поста, смена группировки) + qs = [] + for k, v in (("direction", direction), ("status", status), ("own", own), ("q", q)): + if v: + qs.append(f"{k}={quote(v)}") + if not selected: + selected = sel["id"] if sel else 0 + filters_qs = "&".join(qs) html = tpl.get_template("candidates.html").render( posts=grouped, counts=counts, status=status, direction=direction, own=own, - q=q, group_by=group_by, selected=sel, error=error, + q=q, group_by=group_by, selected=sel, error=error, filters_qs=filters_qs, directions=DIRECTIONS, STATUS_LABELS=STATUS_LABELS, STATUS_COLORS=STATUS_COLORS, ) return HTMLResponse(html) diff --git a/web/templates/candidates.html b/web/templates/candidates.html index 806b4d8..8bc288d 100644 --- a/web/templates/candidates.html +++ b/web/templates/candidates.html @@ -45,30 +45,24 @@ -