Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /DeepselSystems_deepsel-cms /backend /apps /cms /mixins /menu.py
| from sqlalchemy.orm import Session | |
| from typing import Optional | |
| from deepsel.orm import ( | |
| PAGINATION, | |
| SearchQuery, | |
| OrderByCriteria, | |
| ) | |
| class MenuMixin: | |
| """Business logic for menus: simplified get_one and default position ordering.""" | |
| def get_one(cls, db: Session, user, item_id: int, *args, **kwargs): | |
| res = db.query(cls).get(item_id) | |
| return res | |
| def search( | |
| cls, | |
| db: Session, | |
| user, | |
| pagination: PAGINATION, | |
| search: Optional[SearchQuery] = None, | |
| order_by: Optional[OrderByCriteria] = None, | |
| *args, | |
| **kwargs, | |
| ): | |
| # Default ordering by position | |
| if order_by is None: | |
| order_by = OrderByCriteria(field="position", direction="asc") | |
| return super().search(db, user, pagination, search, order_by, *args, **kwargs) | |
Xet Storage Details
- Size:
- 882 Bytes
- Xet hash:
- 7e68e0673c8f1e469689bef82fdcf81797056fe4012b125118b2f49914bb319e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.