Django

Code

Ticket #2053 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

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

Reported by: john@sneeu.com Assigned to: adrian
Milestone: Component: Template system
Version: SVN Keywords: timeslice timeuntil filter
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

timeslice.diff (0.9 kB) - added by john@sneeu.com on 05/31/06 14:24:52.
[patch] for this ticket.
timesince.diff (4.0 kB) - added by john@sneeu.com on 06/05/06 13:13:09.
[patch] for this ticket.

Change History

05/31/06 14:24:52 changed by john@sneeu.com

  • attachment timeslice.diff added.

[patch] for this ticket.

05/31/06 14:30:13 changed by john@sneeu.com

  • 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.

06/01/06 15:21:23 changed by adrian

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

06/05/06 13:13:09 changed by john@sneeu.com

  • attachment timesince.diff added.

[patch] for this ticket.

06/05/06 13:14:25 changed by john@sneeu.com

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

06/21/06 01:56:09 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #2053 ([patch] Changed timesince filter to take an optional datetime object & added timeuntil filter)




Change Properties
Action