Opened 6 years ago

Closed 6 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 6 years ago by Johannes Dollinger

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: invalid
Severity: Release blockerNormal
Status: newclosed

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