Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#2518 closed defect (worksforme)

Should not use datetime.today() to filter datetime field

Reported by: anonymous Owned by: adrian
Component: contrib.admin Version: 0.91
Severity: normal Keywords: date time
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

datetime.today() does not consider time zone.
So if u use it to filter datetime filed, it does not work correctly.

Just like int tutorial

was_published_today should be written like this

def was_published_today(self)

return self.pub_date.date() == datetime.date(time.localtime[:3])

Change History (4)

comment:1 Changed 9 years ago by anonymous

  • Version set to 0.91

comment:2 Changed 9 years ago by adrian

  • priority changed from highest to normal
  • Severity changed from critical to normal

comment:3 Changed 9 years ago by adrian

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

Please reopen this with more information -- I can't replicate this.

comment:4 Changed 8 years ago by adrian

  • milestone Version 0.93 deleted

Milestone Version 0.93 deleted

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