Author: mtredinnick
Date: 2010-03-09 21:41:41 -0600 (Tue, 09 Mar 2010)
New Revision: 12743
Modified:
django/trunk/docs/ref/models/querysets.txt
Log:
Fixed #11711 -- clarified that ValuesQuerySets are not lists per se.
It rarely hurts to think of the returned result from a values() or
values_list() call as a list, but it's really an iterable and sometimes
the difference matters.
Modified: django/trunk/docs/ref/models/querysets.txt
===================================================================
--- django/trunk/docs/ref/models/querysets.txt 2010-03-10 03:12:48 UTC (rev
12742)
+++ django/trunk/docs/ref/models/querysets.txt 2010-03-10 03:41:41 UTC (rev
12743)
@@ -361,8 +361,8 @@
``values(*fields)``
~~~~~~~~~~~~~~~~~~~
-Returns a ``ValuesQuerySet`` -- a ``QuerySet`` that evaluates to a list of
-dictionaries instead of model-instance objects.
+Returns a ``ValuesQuerySet`` -- a ``QuerySet`` that returns dictionaries when
+used as an iterable, rather than model-instance objects.
Each of those dictionaries represents an object, with the keys corresponding to
the attribute names of model objects.
@@ -446,10 +446,10 @@
.. versionadded:: 1.0
-This is similar to ``values()`` except that instead of returning a list of
-dictionaries, it returns a list of tuples. Each tuple contains the value from
-the respective field passed into the ``values_list()`` call -- so the first
-item is the first field, etc. For example::
+This is similar to ``values()`` except that instead of returning dictionaries,
+it returns tuples when iterated over. Each tuple contains the value from the
+respective field passed into the ``values_list()`` call -- so the first item is
+the first field, etc. For example::
>>> Entry.objects.values_list('id', 'headline')
[(1, u'First entry'), ...]
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.