summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2014-12-06 13:00:09 -0800
committerTim Graham <timograham@gmail.com>2014-12-08 07:58:23 -0500
commit4468c08d70b5b722f3ebd4872909e56580ec7d68 (patch)
tree3da12d757bc9b586df4ba39da20b8793abcae76e /docs/ref
parentb327a614eb7d885441c6a2575e10b70ac1352aae (diff)
Fixed #23968 -- Replaced list comprehension with generators and dict comprehension
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/querysets.txt6
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index 2bd24357cf..6784f352ed 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -882,8 +882,8 @@ For example, suppose you have these models::
toppings = models.ManyToManyField(Topping)
def __str__(self): # __unicode__ on Python 2
- return "%s (%s)" % (self.name, ", ".join([topping.name
- for topping in self.toppings.all()]))
+ return "%s (%s)" % (self.name, ", ".join(topping.name
+ for topping in self.toppings.all()))
and run::
@@ -1600,7 +1600,7 @@ found, ``get_or_create()`` will instantiate and save a new object, returning a
tuple of the new object and ``True``. The new object will be created roughly
according to this algorithm::
- params = dict([(k, v) for k, v in kwargs.items() if '__' not in k])
+ params = {k: v for k, v in kwargs.items() if '__' not in k}
params.update(defaults)
obj = self.model(**params)
obj.save()