https://github.com/dmitryfillo/noffset
https://github.com/dmitryfillo/noffset
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/dmitryfillo/noffset
- Owner: DmitryFillo
- License: other
- Created: 2013-06-18T23:12:15.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2017-11-11T00:10:01.000Z (over 8 years ago)
- Last Synced: 2025-01-11T01:12:39.106Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
noffset
=======
**OBSOLETED! Not supported, just history.**
Summary
-------
Fast pagination for sql-like databases. **Does not use offset!** `See presentation `_.
Supports: SQLAlchemy.
Explanatory example
--------------
.. code-block:: python
import noffset.sqla.pagination as pagination
#### `cursor`, `direction`, `reverse` are optional. If these are not defined func will return param for first page.
to_template = pagination(sqla_db_object, db_model_class, perpage_items_num, cursor, direction, reverse)
*to_template* is **dict(data, cursor_next, cursor_prev, pages_total)** now.
.. code-block:: html
data: {{ to_template['data'] }}
next button: next
prev button: prev
What about *reverse* param? If False last item in DB will be first (like newspapers, comments, etc). If True last item in DB will be honestly last.
Simply. Also see the source code.