Code

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#2053 closed enhancement (fixed)

[patch] Changed timesince filter to take an optional datetime object & added timeuntil filter

Reported by: john@… Owned by: adrian
Component: Template system Version: master
Severity: minor Keywords: timeslice timeuntil filter
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Useful if we have a blog and want to display comments as "commented 2 hours after the post".

Also added the timeuntil filter for completeness.

Attachments (2)

timeslice.diff (939 bytes) - added by john@… 8 years ago.
[patch] for this ticket.
timesince.diff (4.0 KB) - added by john@… 8 years ago.
[patch] for this ticket.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by john@…

[patch] for this ticket.

comment:1 Changed 8 years ago by john@…

  • Summary changed from [patch] Changed timeslice filter to take an optional datetime object & added timeuntil filter to [patch] Changed timesince filter to take an optional datetime object & added timeuntil filter

timeslice should be timesince, in every instance - sorry.

comment:2 Changed 8 years ago by adrian

Can you add some unit tests for these two filters, please? They should go in tests/othertests/templates.py.

Changed 8 years ago by john@…

[patch] for this ticket.

comment:3 Changed 8 years ago by john@…

The correctly named patch, with Unit Tests and some slight tweaks to the code.

comment:4 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [3185]) Fixed #2053 -- added an optional comparison argument to the "timesince" filter.
Added a "timeuntil" filter that works analogously. Thanks, john@….

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.