diff options
| author | Tim Graham <timograham@gmail.com> | 2016-12-27 09:58:42 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-12-27 10:00:03 -0500 |
| commit | f38f2032c577c484a0480f1d7aad39d495c63e33 (patch) | |
| tree | d1f1d6b28c1b17d2746f4aa43fd69524c951c310 /docs | |
| parent | 25e8222615f75e55673dd7a54aa50b77762b6f8c (diff) | |
Used a nontemporal example in QuerySet.bulk_create() in docs.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/querysets.txt | 5 | ||||
| -rw-r--r-- | docs/topics/db/optimization.txt | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 7e2dc7abca..268fa42d70 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1826,9 +1826,8 @@ efficient manner (generally only 1 query, no matter how many objects there are):: >>> Entry.objects.bulk_create([ - ... Entry(headline="Django 1.0 Released"), - ... Entry(headline="Django 1.1 Announced"), - ... Entry(headline="Breaking: Django is awesome") + ... Entry(headline='This is a test'), + ... Entry(headline='This is only a test'), ... ]) This has a number of caveats though: diff --git a/docs/topics/db/optimization.txt b/docs/topics/db/optimization.txt index 446ec87256..66326f2fb1 100644 --- a/docs/topics/db/optimization.txt +++ b/docs/topics/db/optimization.txt @@ -339,14 +339,14 @@ When creating objects, where possible, use the number of SQL queries. For example:: Entry.objects.bulk_create([ - Entry(headline="Python 3.0 Released"), - Entry(headline="Python 3.1 Planned") + Entry(headline='This is a test'), + Entry(headline='This is only a test'), ]) ...is preferable to:: - Entry.objects.create(headline="Python 3.0 Released") - Entry.objects.create(headline="Python 3.1 Planned") + Entry.objects.create(headline='This is a test') + Entry.objects.create(headline='This is only a test') Note that there are a number of :meth:`caveats to this method <django.db.models.query.QuerySet.bulk_create>`, so make sure it's appropriate |
