Code

#19983 closed Cleanup/optimization (needsinfo)

Improving this part from confusion

Reported by: fourmikichante@… Owned by: nobody
Component: Documentation Version: 1.5
Severity: Normal 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

At the point where we are asked to add the unicode method, the tutorial seems to be taking a shortcut by saying :

*
Wait a minute. <Poll: Poll object> is, utterly, an unhelpful representation of this object. Let’s fix that by editing the polls model (in the polls/models.py file) and adding a unicode() method to both Poll and Choice:

class Poll(models.Model):

# ...
def unicode(self):

return self.question

class Choice(models.Model):

# ...
def unicode(self):

return self.choice_text

*

This was very confusing to me, and though i managed to put bits of code together and make this work, I have no idea whether or not i did it right.

Could you perhaps improve this part of the tutorial by being more comprehensive ?

Attachments (0)

Change History (2)

comment:1 Changed 16 months ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Thanks for the feedback. Could you please be a bit more specific about what you found confusing and offer a suggestion for how to improve it?

comment:2 Changed 16 months ago by timo

  • Resolution set to needsinfo
  • Status changed from new to closed

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.