Git Product home page Git Product logo

Comments (4)

allo- avatar allo- commented on July 21, 2024
  • Address of the current page: from xxxx-xx-xx_xx:xx to yyyy-yy-yy_yy-yy
  • Address of the next / previous page: Allow Steps 1 hour / day / ... or based on post volume (calculate the date range of the next 20 posts) and "everything after start date"
  • Allow loading more items with ajax on the current page
  • Maybe use history API and scroll position to update the url to page / #item_id links. Avoid cluttering the browser history with too many entries.

Alternatives for previous page:

  • count 20 items backwards, take date of this item and store it in normal since/PREVIOUS_DATE/ascending format
  • store date of the first item of the current page + direction backwards like before/CURRENT_DATE/ascending/ and calculate the minus 20 before the date on access.

from feedjack.

allo- avatar allo- commented on July 21, 2024
  • Display 20 Items
  • Text "123 older posts" (link: previous)
  • Text "456 newer posts" (link: next)

Link next: since (last post on page)
Link previous: filter(date__lt=first_post.date).order_by("-id)[:20].order_by("id") (order backward, get 20 posts, order forward)

Alternative: Use calculated permalinks ?from=date1&to=date2&order=asc, which may change the number of posts in between. Integrate with endless scroll, which loads this via ajax on scrolling.

from feedjack.

allo- avatar allo- commented on July 21, 2024

Forward pagination with (or without) ajax works after commit 6cfeff3.

TODO:

  • Add "X later items" 1e4b062 acfd6d4
  • Add "previous" (needs to calculate items backwards and use the appropriate since= parameter)
    • reverse ordering, then count posts_per_page items forward and use the date there as since= parameter. Leave asc= as it is.
  • Add a "until" parameter 06c7250

The until= parameter will be needed in the pagination for pages with less then posts_per_page items.

When having 5 Items per page and these pages (previous, current, next) are:

``[1, 2] [3, 4, 5, 6, 7] [8,9]``

the previous page with respect to ordering (either 1 or 3) should only contain 2 items. so a since= alone would for example produce

``[1, 2, 3, 4, 5]``

which contains 3 entries from the current page on the "previous page".

For forward pagination not having an until-parameter means that a page can get new items on reload, if it was incomplete before, which probably is okay.

from feedjack.

allo- avatar allo- commented on July 21, 2024

Completed with commit bf943e6.

from feedjack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.