# HG changeset patch # User Brian Neal # Date 1299358466 0 # Node ID cb121a3abf468a0f63bd899518bb8b4b74798716 # Parent 5219c7cc5a53d323d9d8f7c7a088e80d8ee65307 Fixing #176; add a side block for current polls. diff -r 5219c7cc5a53 -r cb121a3abf46 gpp/polls/models.py --- a/gpp/polls/models.py Sat Mar 05 19:40:31 2011 +0000 +++ b/gpp/polls/models.py Sat Mar 05 20:54:26 2011 +0000 @@ -1,7 +1,7 @@ -''' +""" Models for the Polls application. -''' +""" import datetime from django.db import models from django.db.models import Q @@ -30,7 +30,7 @@ start_date = models.DateTimeField(db_index=True, help_text='Date/time the poll will be eligible for voting.',) end_date = models.DateTimeField(blank=True, null=True, db_index=True, - help_text='Date/time the poll will be ineligible for voting. '\ + help_text='Date/time the poll will be ineligible for voting. ' 'Leave blank for an open ended poll.') is_enabled = models.BooleanField(default=True, db_index=True, help_text='Check to allow the poll to be viewed on the site.') diff -r 5219c7cc5a53 -r cb121a3abf46 gpp/polls/templatetags/poll_tags.py --- a/gpp/polls/templatetags/poll_tags.py Sat Mar 05 19:40:31 2011 +0000 +++ b/gpp/polls/templatetags/poll_tags.py Sat Mar 05 20:54:26 2011 +0000 @@ -1,5 +1,5 @@ """ -Template tags for the Polls application. +Template tags for the Polls application. """ from django import template @@ -15,4 +15,10 @@ except IndexError: poll = None - return {'poll': poll } + return {'poll': poll} + + +@register.inclusion_tag("polls/latest_poll_block_tag.html") +def latest_poll_block(): + polls = Poll.objects.get_current_polls() + return {'polls': polls} diff -r 5219c7cc5a53 -r cb121a3abf46 gpp/templates/base.html --- a/gpp/templates/base.html Sat Mar 05 19:40:31 2011 +0000 +++ b/gpp/templates/base.html Sat Mar 05 20:54:26 2011 +0000 @@ -8,6 +8,7 @@ {% load potd_tags %} {% load messages_tags %} {% load script_tags %} +{% load poll_tags %} {% load cache %} SurfGuitar101.com | {% block title %}{% endblock %} @@ -80,6 +81,7 @@ {% cache 60 irc_block %} {% irc_status %} {% endcache %} + {% latest_poll_block %} {% include 'core/mp3comp_block.html' %} diff -r 5219c7cc5a53 -r cb121a3abf46 gpp/templates/polls/latest_poll_block_tag.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/polls/latest_poll_block_tag.html Sat Mar 05 20:54:26 2011 +0000 @@ -0,0 +1,15 @@ +{% extends 'side_block.html' %} +{% load url from future %} +{% block block_title %}Current Polls{% endblock %} +{% block block_content %} +{% if polls %} + +{% else %} +

No polls at this time. Check out our +past polls.

+{% endif %} +{% endblock %}