Opened 17 years ago

Closed 17 years ago

#4856 closed (invalid)

Error in tutorial

Reported by: daniel.lauk@… Owned by: Jacob
Component: Documentation Version: 0.96
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I was following the tutorial. In interactive mode, for printing, __unicode__() is not being called, but __str__() is.

#
# Won't work for me
#
class Poll(models.Model):
    question = models.CharField(maxlength=200)
    pub_date = models.DateTimeField('date published')

    def __unicode__(self):
        return self.question
#
# Will work for me
#
class Poll(models.Model):
    question = models.CharField(maxlength=200)
    pub_date = models.DateTimeField('date published')

    def __unicode__(self):
        return self.question

    def __str__(self):
        return self.__unicode__()

System information:

  • Python 2.4.1
  • settings.py: DATABASE_ENGINE = 'sqlite3'
  • Windows 2000

Change History (1)

comment:1 by John Shaffer <jshaffer2112@…>, 17 years ago

Resolution: invalid
Status: newclosed

If you're using Django 0.96, you should be using the 0.96 tutorial: http://www.djangoproject.com/documentation/0.96/tutorial01/

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