[1.11.x] Fixed mistakes in docs/topics/db/examples/many_to_one.txt.
Backport of 9d7e2c7b447b2bbabe746770ebd26465cc564f05 from master
This commit is contained in:
parent
d2906d7c17
commit
4aa097e94e
@ -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>]>
|
||||
|
Loading…
x
Reference in New Issue
Block a user