canonical-django team mailing list archive
-
canonical-django team
-
Mailing list archive
-
Message #00012
if date < now
I'm playing with Google App Engine. I'm using the Django templating system
and want to do something I've not tried to do before.
I'm getting a list of events using something like Events.all() and then
showing them in a table. My template looks like this:
{% for event in events %}
<tr>
<td>{{ event.title }}</td>
<td>{{ event.started|date:"l, F jS" }}</td>
<td><a href="/manage/edit/{{ event.key.id }}/">edit</a></td>
</tr>
{% endfor %}
What I'd love to do is add a class to the <tr> if the event date is in the
future but within some short period (like 3 days) and then a different class
if the event is in the past. I'm OK w/ doing just the class for past dates.
However I can't seem to find a way to do any kind of comparison short of
pre-processing all the rows from the query to add a boolean for each row
indicating that the event is near or in the past.
Anyone have a tip that might help?
--
Matthew Nuzum
newz2000 on freenode, skype, linkedin, identi.ca and twitter
Follow ups