Finally fixed pager behavior.
This commit is contained in:
parent
d55539192e
commit
52bd0d4c91
3 changed files with 34 additions and 25 deletions
|
|
@ -12,6 +12,8 @@ from ..service import CrudService
|
|||
from ..eager import default_eager_policy
|
||||
from .type_map import build_form_schema
|
||||
|
||||
Session = None
|
||||
|
||||
def make_fragments_blueprint(db_session_factory, registry: Dict[str, Any], *, name="frags"):
|
||||
"""
|
||||
HTML fragments for HTMX/Alpine. No base pages. Pure partials:
|
||||
|
|
@ -20,8 +22,18 @@ def make_fragments_blueprint(db_session_factory, registry: Dict[str, Any], *, na
|
|||
GET /<model>/frag/rows -> <tr>...</tr> + pager markup if wanted
|
||||
GET /<model>/frag/form -> <form>...</form> (auto-generated)
|
||||
"""
|
||||
global Session
|
||||
if Session is None:
|
||||
Session = scoped_session(db_session_factory)
|
||||
|
||||
bp = Blueprint(name, __name__, template_folder="templates")
|
||||
def session(): return scoped_session(db_session_factory)()
|
||||
|
||||
def session():
|
||||
return Session
|
||||
|
||||
@bp.teardown_app_request
|
||||
def remove_session(exc=None):
|
||||
Session.remove()
|
||||
|
||||
def _parse_filters(args):
|
||||
reserved = {"page", "per_page", "sort", "expand", "fields", "value", "label", "label_tpl", "fields_csv", "li_label", "li_sublabel"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue