推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
bb2018
V2EX  ›  Python

django bbs 在模板里这样循环楼层:{{ forloop.counter }}楼,如果遇到分页。第二页又从 1 开始计数了。这个有什么好办法解决? 让楼层接下去?

  •  
  •   bb2018 · Aug 5, 2017 · 2854 views
    This topic created in 3196 days ago, the information mentioned may be changed or developed.
    2 replies    2017-08-05 18:55:04 +08:00
    Qyroth
        1
    Qyroth  
       Aug 5, 2017
    没用过 django,参考一下
    {{ forloop.counter + (当前页码-1) * 每页条目数 }}
    solidsnake
        2
    solidsnake  
       Aug 5, 2017 via iPhone
    Paginatior 直接用啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3300 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 11:55 · PVG 19:55 · LAX 04:55 · JFK 07:55
    ♥ Do have faith in what you're doing.