[Zope] displaying based on date
Marco Mariani
m.mariani@imola.nettuno.it
Tue, 26 Sep 2000 00:18:11 +0200
On Mon, Sep 25, 2000 at 05:00:47PM -0500, Timothy Wilson wrote:
> I've created a ZClass and I'm using an HTML table to display certain
> properties of the class. One of the properties is a date, and I want to
> display in the table only those instances of the ZClass for which this
> certain date property is in the future. (It's a job posting ZClass, and I
> only want to display jobs that haven't yet closed.)
>
> I see in the ZQR that there is an 'isFuture' test that looks like it is
> associated with fmt. ZQR says for isFuture, "Return true if this object
> represents a date/time later than the time of the call."
>
> Can I combine this with a <dtml-if>? Is there a more elegant way?
Yes, like in:
<dtml-in some_items sort=date>
<dtml-if "date.isFuture()">
[...]
</dtml-if>
</dtml-in>
Where some_items is a list of objects with a date property.
I think it's nice enough.
You may even collapse everything in a row (untested):
<dtml-in "filter(lambda x:x.date.isFuture(), some_items)" sort=date>
</dtml-in>
--
"This company has performed an illegal operation and will be shut down.
If the problem persists, contact your vendor or appeal to a higher court."
- Signal11 on slashdot