Opened 5 years ago

Closed 5 years ago

#15883 closed Bug (invalid)

Error in tutorial 01 when defining was_published_today()

Reported by: anonymous Owned by: nobody
Component: * Version: 1.3
Severity: Normal Keywords: tutorial, custo method
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX:


This custom method is exposed as a example:

import datetime
# ...
class Poll(models.Model):

# ...
def was_published_today(self):

return ==

The return clause of this method should be: return self.pub_date ==

Regards !

Change History (1)

comment:1 Changed 5 years ago by emulbreh

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Severity changed from Release blocker to Normal
  • Status changed from new to closed

pub_date is defined as a DateTimeField, thus self.pub_date is a datetime.datetime instance, not a instance.

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