Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#1385 closed defect (fixed)

[PATCH] allow timesince filter to work with objects

Reported by: matt Owned by: Adrian Holovaty
Component: Template system Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The timesince filter currently throws an AttributeError when applied to a object:

'defaultfilters' module: API test raised an exception
Code: 'timesince( - datetime.timedelta(1))'
Line: 232
Exception:   File "/Users/mcroydon/django/django_src.trunk/tests/", line 1243, in __run
    compileflags, 1) in test.globs
  File "<doctest defaultfilters[76]>", line 1, in ?
    timesince( - datetime.timedelta(1))
  File "/Users/mcroydon/django/django_src.trunk/django/core/template/", line 343, in timesince
    return timesince(value)
  File "/Users/mcroydon/django/django_src.trunk/django/utils/", line 22, in timesince
    if d.tzinfo:
AttributeError: '' object has no attribute 'tzinfo'

The patch includes a test to confirm this behavior. The test passes after applying this patch.

Attachments (1)

timesince.patch (1.0 KB) - added by matt 13 years ago.
Enable timesince with

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by matt

Attachment: timesince.patch added

Enable timesince with

comment:1 Changed 13 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [2375]) Fixed #1385 -- Allowed timesince filter to accept objects. Thanks, Matt

comment:2 Changed 12 years ago by (none)

milestone: Version 1.0

Milestone Version 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top