Search code examples
pythonflaskpeeweeflask-peewee

Get next row in peewee


I creating blog using Flask and peewee

this is the sample query to get the current post using url

total_data = wired_model.EN.select().order_by(wired_model.EN.id.desc())
post = total_data.where(wired_model.EN.url == url).get()

I am using total_data to get the recent posts, now I want to show a link to next post and the previous post in the current post, is there a simple way to do it in peewee like next_row()


Solution

  • Use "offset":

    .limit(1).offset(1)