Use the "M, j" format for last call end date too.

Add the year to the date field when it's not this year, using a new template tag "thisyear" which returns a boolean.
Also implement template tag "inpast" which I think could be useful for the meeting materials page.
 - Legacy-Id: 599
This commit is contained in:
Bill Fenner 2007-06-21 20:03:39 +00:00
parent c454d56ce1
commit 09c0829127
2 changed files with 17 additions and 2 deletions

View file

@ -7,6 +7,7 @@ try:
except ImportError:
from email import Utils as emailutils
import re
import datetime
#from ietf.utils import log
register = template.Library()
@ -155,3 +156,17 @@ def rfcnospace(string):
def lstripw(string, chars):
"""Strip matching leading characters from words in string"""
return " ".join([word.lstrip(chars) for word in string.split()])
@register.filter(name='thisyear')
def thisyear(date):
"""Returns a boolean of whether or not the argument is this year."""
if date:
return date.year == datetime.date.today().year
return True
@register.filter(name='inpast')
def inpast(date):
"""Returns a boolean of whether or not the argument is in the past."""
if date:
return date < datetime.datetime.now()
return True

View file

@ -4,11 +4,11 @@
<td nowrap>
{% ifequal doc.cur_state.state "In Last Call" %}
{% if doc.document.lc_expiration_date %}
{{ doc.document.lc_expiration_date }}
{{ doc.document.lc_expiration_date|date:"M j" }}{% if not doc.lc_expiration_date|thisyear %}, {{ doc.lc_expiration_date|date:"Y" }}{% endif %}
{% endif %}
{% else %}
{% if doc.status_date %}
{{ doc.status_date|date:"M j" }}
{{ doc.status_date|date:"M j" }}{% if not doc.status_date|thisyear %}, {{ doc.status_date|date:"Y" }}{% endif %}
{% endif %}
{% endifequal %}</td>
{% else %}