Updating table templates and logic.
This commit is contained in:
parent
559fd56f33
commit
56debd88c2
8 changed files with 12 additions and 830 deletions
|
|
@ -108,6 +108,11 @@ def build_query(Model, spec: QuerySpec, eager_policy=None):
|
|||
col = getattr(Model, key[1:] if desc_ else key)
|
||||
stmt = stmt.order_by(desc(col) if desc_ else asc(col))
|
||||
|
||||
if not spec.order_by and spec.page and spec.per_page:
|
||||
pk_cols = inspect(Model).primary_key
|
||||
if pk_cols:
|
||||
stmt = stmt.order_by(*(asc(c) for c in pk_cols))
|
||||
|
||||
# eager loading
|
||||
if eager_policy:
|
||||
opts = eager_policy(Model, spec.expand)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue