Code

Opened 7 years ago

Closed 7 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

Attachments (0)

Change History (1)

comment:1 Changed 7 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/

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.