Opened 4 years ago

Closed 4 years ago

#16668 closed Bug (worksforme)

Problem with was_published_today()

Reported by: dan.j.hakimi@… Owned by: nobody
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


On, you write the following function:

def was_published_today(self):
        return ==

This doesn't work (I tried it), as "today" returns a full datetime, instead of just a date (odd, I guess). Instead, you want:

def was_published_today(self):
        return ==

Or something else that works.

Change History (2)

comment:1 Changed 4 years ago by daniellawrence

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

The was_published_today should be returning a Boolean not the date.

I was unable to replicate the fault with the following commands.

 $ python shell
 >>> from polls.models import Poll,Choice
 >>> import datetime
 >>> p = Poll(question="What's up?",
 >>> p.was_published_today()
 >>> p.pub_date = datetime.datetime(2007, 4, 1, 0, 0)
 >>> p.was_published_today()

comment:2 Changed 4 years ago by daniellawrence

  • Resolution set to worksforme
  • Status changed from new to closed
  • Triage Stage changed from Unreviewed to Accepted
Note: See TracTickets for help on using tickets.
Back to Top