I am creating a simple blog as part of a website and I am getting stuck on something that I am assuming is simple.
If I call any blog post, say by it's title, from a queryset, how can I get the entry before and after the post in it's published order.
I can iterate over the whole thing, get the position of the entry I have and use that to call the one before and the one after. But that is a long bit of code for something that I am sure I can do more simply.
What I want would be something like this:
next_post = Posts.object.filter(title=current_title).order_by("-published")[-1]
Of course because of the filter, it is not going to work, but just to give you the idea of what I am looking for.