summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-04-24 11:11:30 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-04-24 11:11:30 +0000
commit9d6f0f9e1085d963d96168efaf07315613cb8cc0 (patch)
tree1cf5fe92ac50f570d575c3f43e9ac0b0eb39c53c /docs
parent27b0a4c4e7cb491b24c802f00e06ae0c6b3cc57d (diff)
queryset-refactor: Renamed the Queryset method valueslist() to values_list.
Suggested by Michael Trier. It's more consistent with order_by, select_related, etc. This is backwards incompatible for people previously using this method on the branch (the method doesn't exist on trunk, so it's very minor). git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7451 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/db-api.txt12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt
index 9dd64d0508..bda7cb7571 100644
--- a/docs/db-api.txt
+++ b/docs/db-api.txt
@@ -648,32 +648,32 @@ followed (optionally) by any output-affecting methods (such as ``values()``),
but it doesn't really matter. This is your chance to really flaunt your
individualism.
-``valueslist(*fields)``
+``values_list(*fields)``
~~~~~~~~~~~~~~~~~~~~~~~
**New in Django development version**
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 ``valueslist()`` call -- so the first
+the respective field passed into the ``values_list()`` call -- so the first
item is the first field, etc. For example::
- >>> Entry.objects.valueslist('id', 'headling')
+ >>> Entry.objects.values_list('id', 'headling')
[(1, u'First entry'), ...]
If you only pass in a single field, you can also pass in the ``flat``
parameter. If ``True``, this will mean the returned results are single values,
rather than one-tuples. An example should make the difference clearer::
- >>> Entry.objects.valueslist('id').order_by('id')
+ >>> Entry.objects.values_list('id').order_by('id')
[(1,), (2,), (3,), ...]
- >>> Entry.objects.valueslist('id', flat=True).order_by('id')
+ >>> Entry.objects.values_list('id', flat=True).order_by('id')
[1, 2, 3, ...]
It is an error to pass in ``flat`` when there is more than one field.
-If you don't pass any values to ``valueslist()``, it will return all the
+If you don't pass any values to ``values_list()``, it will return all the
fields in the model, in the order they were declared.
``dates(field, kind, order='ASC')``