Opened 8 years ago

Closed 8 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: UI/UX:

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 Changed 8 years ago by John Shaffer <jshaffer2112@…>

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

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