Opened 12 years ago

Closed 12 years ago

#20405 closed Bug (fixed)

documentation error, v1.4, missing argument in example code (models.Manager)

Reported by: bjb@… Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Error in code example for https://docs.djangoproject.com/en/1.4/ref/models/instances/#creating-objects.

In the recommended code (option 2), the BookManager method "create_book" should have an extra argument "self". This has been done correctly on the corresponding documentation pages for django version 1.5 and dev. The documentation of this did not exist prior to version 1.4.

bad:
<pre>
class BookManager(models.Manager):

def create_book(title):

book = self.create(title=title)
# do something with the book
return book

</pre>

good:
<pre>
class BookManager(models.Manager):

def create_book(self, title):

book = self.create(title=title)
# do something with the book
return book

</pre>

Change History (1)

comment:1 by Tim Graham, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top