view sg101/templates/polls/index.html @ 1090:71685387dd11

Reduce database usage on poll index page.
author Brian Neal <bgneal@gmail.com>
date Mon, 09 May 2016 19:48:51 -0500
parents ee87ea74d46b
children f7554fb88727
line wrap: on
line source
{% extends 'base.html' %}
{% load comment_tags %}
{% block title %}Polls{% endblock %}
{% block content %}
   <h2>Polls</h2>
   <h3>Current Polls</h3>
   {% if current_polls %}
   <ul>
   {% for poll in current_polls %}
      <li><a href="{{ poll.get_absolute_url }}">{{ poll.question }}</a> &bull; 
      {{ poll.total_votes_ }} vote{{ poll.total_votes_|pluralize }} &bull;
      {{ poll.start_date|date:"M d, Y" }}
      {% if poll.end_date %}
         - {{ poll.end_date|date:"M d, Y" }}
      {% endif %}
      </li>
   {% endfor %}
   </ul>
   {% else %}
   <p>No open polls at this time.</p>
   {% endif %}
   <h3>Closed Polls</h3>
   {% if old_polls %}
   <ul>
   {% for poll in old_polls %}
      <li><a href="{{ poll.get_absolute_url }}">{{ poll.question }}</a> &bull; 
      {{ poll.total_votes_ }} vote{{ poll.total_votes_|pluralize }} &bull;
      {{ poll.start_date|date:"M d, Y" }} -
         {{ poll.end_date|date:"M d, Y" }}</li>
   {% endfor %}
   </ul>
   {% else %}
   <p>No closed polls at this time.</p>
   {% endif %}
{% endblock %}