How to have next and previous links on a webpage in django:

99 Views Asked by At

I am using django Python Templates to write a blog. I have two different frames for this particular Blog. To load links on left side frame I have written the following code:

 {% for post in posts %}

    <div class="post">

        <ul style="padding: 1px;">


            <li style="border-bottom: dotted 1px; padding: 1px;"><a id="myid{{forloop.counter}}" href="{{post.get_absolute_url}}" Target="post" >
                {{post.title}}

            </a></li>

        </ul>

        <p>

        </p>
    </div>
    {% endfor %}

On Right side to load a particular POST following code is used:

 <h1> {{post.description}} </h1>


    {{post.content|safe|linebreaks}}

I want to add Next and previous links on my blog. How to do it in django template. My blog is uploaded on matmock.pythonanywhere.com

1

There are 1 best solutions below

1
On

What you are looking for is called pagination. Here's the tutorial for your reference.