Files @ 5c7710954b2e
Branch filter:

Location: website/www/conservancy/templates/news/pressrelease_list.html

bkuhn
Attempt to use Django 1.7 Paginator object.

Upon reading
https://docs.djangoproject.com/en/1.7/topics/pagination/#using-paginator-in-a-view

I wonder if we should simply follow this model for pagination of news
items. I've attempted to adapt that herein. This is a first attempt
and likely will have issues.
{% extends "base_news.html" %}
{% block subtitle %}News - {% endblock %}

{% block outercontent %}
    <div id="container">
         <div id="sidebar" class="{% block submenuselection %}other{% endblock %}">
         <h2>News Index by Year</h2>
         <ul>
         {% for year in date_list reversed %}<li class="{{ year|date:"Y" }}"><a href="{{ year|date:"Y" }}/">{{ year|date:"Y" }}</a></li>{% endfor %}
         </ul>
         </div>
         <div id="mainContent">
         <h1><a href="/feeds/news/" class="feedlink"><img src="/img/feed-icon-14x14.png" alt="[RSS]"/></a> Conservancy News</h1>


{% ifnotequal news.number 1 %}<p>(page {{ news.number }} of {{ news.paginator.num_pages }})</p>{% endifnotequal %}

{% for object in news %}
    <div class="shaded">
    <p class="date">{{ object.pub_date|date:"F j, Y" }}</p>
    <h3><a href="{{ object.get_absolute_url }}">{{ object.headline|safe }}</a></h3>
    {% if object.is_recent %}
        {% if object.subhead %}<h4>{{ object.subhead|safe }}</h4>{% endif %}
        {{ object.summary|safe }}
    {% if object.body %}<p><span class="continued"><a href="{{ object.get_absolute_url }}">Read More...</a></span></p>{% endif %}
    {% endif %}
    </div>
{% endfor %}

<p>
{% if news.has_next %}<a class="next_page_button" href="?page={{ next }}">Next page (older) &raquo;</a>{% endif %}
{% if news.has_previous %}<a href="?page={{ previous }}">&laquo; Previous page (newer)</a>{% endif %}
{% comment %}{% for pagenum in news.paginator.page_range %}{% ifequal pagenum news.number %}[{{ pagenum }}]{% else %}<a href="?page={{ pagenum }}">{{ pagenum }}</a>{% endifequal %} {% endfor %}{% endcomment %}
</p>
         </div>
 </div>
<div class="clear"></div>

{% endblock %}