Comments (2)
Yes, this is really a problem that I met it before. But I think it's difficult to remember the count as the params may change on next page (the total depends on the params, not like the example shows to get the total records of the table).
The reasonable way is use cache to remember the number. e.g.
from flask.ext.cache import Cache
cache = Cache(app)
@app.route('/')
def index():
total = cache.get('some-keyword')
if total is None:
g.cur.execute('select count(*) from users where xxx')
total = g.cur.fetchone()[0]
cache.set('some-keyword', total, timeout=300)
# ...
The difficult is define the some-keyword
as the search params may be changed.
from flask-paginate.
Thank you.
from flask-paginate.
Related Issues (20)
- [Regression] AttributeError: 'Pagination' object has no attribute 'bs_version' HOT 2
- Paginate shows all results on the same page. HOT 2
- How add custom href for links? HOT 1
- Implement Custom CSS Style
- Adding pagination breaks dynamic update of checkbox status HOT 1
- Page # in pagination blocks stays at 1 when two pagination blocks are used HOT 2
- css_framework='boostrap3' or css_framework=''bootsrap4' or css_framework='bootstrap' and bs_version=4 not working HOT 2
- flask >= 3, from flask import Markup broken HOT 4
- Missing rel attributes for links HOT 5
- did't show pagination.links HOT 1
- Please add an init parameter to control the url generation behavior for page 1 and prev_page HOT 4
- quote url value of href attribute for bulma css HOT 2
- There is an error in "app.cfg.example" where there is a missing "sign" after records. HOT 1
- Example: No such command 'init_db' HOT 3
- Translate text shown in {{ pagination.info }} HOT 2
- paginate in bootstrap / prev, next btn class HOT 3
- Missing tag for 2021.10.29 release HOT 1
- Does it only work for python Sql module? HOT 2
- TestPagination.test_defaults fails HOT 2
- Missing tag for 2021.12.28 release HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-paginate.