summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuoxzhg <luoxzhg@users.noreply.github.com>2018-04-09 21:12:47 +0800
committerTim Graham <timograham@gmail.com>2018-04-10 12:30:45 -0400
commit4aa097e94e72e0246c882de27d59e37988eabe6f (patch)
tree6bb7ea599f9cb7ff44606732a6d2653c04c16836
parentd2906d7c1739d2a15179a80bd35f880af46cd337 (diff)
[1.11.x] Fixed mistakes in docs/topics/db/examples/many_to_one.txt.
Backport of 9d7e2c7b447b2bbabe746770ebd26465cc564f05 from master
-rw-r--r--docs/topics/db/examples/many_to_one.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/topics/db/examples/many_to_one.txt b/docs/topics/db/examples/many_to_one.txt
index c57d996460..245c809a9e 100644
--- a/docs/topics/db/examples/many_to_one.txt
+++ b/docs/topics/db/examples/many_to_one.txt
@@ -83,7 +83,7 @@ Create an Article via the Reporter object::
Create a new article, and add it to the article set::
- >>> new_article2 = Article(headline="Paul's story", pub_date=date(2006, 1, 17))
+ >>> new_article2 = Article.objects.create(headline="Paul's story", pub_date=date(2006, 1, 17))
>>> r.article_set.add(new_article2)
>>> new_article2.reporter
<Reporter: John Smith>
@@ -105,7 +105,7 @@ Adding an object of the wrong type raises TypeError::
>>> r.article_set.add(r2)
Traceback (most recent call last):
...
- TypeError: 'Article' instance expected
+ TypeError: 'Article' instance expected, got <Reporter: Paul Jones>
>>> r.article_set.all()
<QuerySet [<Article: John's second story>, <Article: This is a test>]>