Django как добавить предыдущую кнопку для связанной записи в блоге?
Я добавил следующую кнопку, но не могу понять, как добавить предыдущую. Я добавил родителя от первого объекта к предыдущему. см. макет для лучшего понимания
blog title parent object next button
(python tutorial - 1 )---->(python tutorial-2)----- >successfully added next button
(python tutorial-2 )------>(python tutorial-3)----- >successfully added next button
(python tutorial-3)-------> Null-------> No button as no parent
мой html:
{{i.blog_title}}
{{i.blog_parent.title}}
{%if i.blog_parent %}
<a href="{% url 'blog:blogDetails' i.blog_parent.blog_slug %}" id="next_button">next_button</a>
{%endif%}
{%endfor%}
Теперь я хочу добавить предыдущую кнопку из второй записи блога в последнюю. Как это сделать? Есть идеи?