diff options
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/querysets.txt | 6 |
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() |
