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: | 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>
Fixed in [6297673efda48e72012da5ccea59d6b55cad3eff]