From 4468c08d70b5b722f3ebd4872909e56580ec7d68 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 6 Dec 2014 13:00:09 -0800 Subject: Fixed #23968 -- Replaced list comprehension with generators and dict comprehension --- docs/ref/models/querysets.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/ref') 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() -- cgit v1.3