开发者

django generic view pagination by item id (not page number)

开发者 https://www.devze.com 2023-01-18 19:13 出处:网络
I love the ease of django\'s pagination system, but is there anyway to tweak it where it\'s paginating by item id instead of page number? Because I am ordering in descending order, if there is an upda

I love the ease of django's pagination system, but is there anyway to tweak it where it's paginating by item id instead of page number? Because I am ordering in descending order, if there is an update on a page while a user is goi开发者_如何转开发ng through the pages, the ordering is off.

For instance, if each page had 3 items

  1. Item #1
  2. Item #2
  3. Item #3

While reading page 1, another user updates, then page 2 for the current user will be

  1. Item #3
  2. Item #4
  3. Item #5


Short answer: No.

To do this you'll need to write your own pagination system; Django's is designed to work with any list-like set of data and the page number system is intractably built in.

0

精彩评论

暂无评论...
验证码 换一张
取 消