Skip to content

Instantly share code, notes, and snippets.

@johanndiedrick
Created February 3, 2014 18:13
Show Gist options
  • Save johanndiedrick/8789210 to your computer and use it in GitHub Desktop.
Save johanndiedrick/8789210 to your computer and use it in GitHub Desktop.
News Pagination Template
{% extends "main.html" %}
{% autoescape None %}
{% block body %}
{% for news_item in news%}
<p>
<b>{{str(news_item['datetime_added'])}}</b>
</p>
<p>
{{ news_item.get('text', '') }}
</p>
{% end %}
<p>
<a href="1">First</a>{% if (currentPage-2) > 1%} | <a href="{{currentPage-2}}">--</a>{% end %} {% if (currentPage-1) > 1 %} | <a href="{{currentPage-1}}">-</a>{% end %} | {{currentPage}} {% if (currentPage + 1) < totalPages %} | <a href="{{currentPage + 1}}">+</a> {% end %} {% if (currentPage + 2) < totalPages %}| <a href="{{currentPage + 2}}">++</a> {% end %}| <a href="{{totalPages +1}}">Last</a>
</p>
{% end %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment