summaryrefslogtreecommitdiff
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/modeltests/lookup/models.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/modeltests/lookup/models.py b/tests/modeltests/lookup/models.py
index d134fb5265..7a53e93aec 100644
--- a/tests/modeltests/lookup/models.py
+++ b/tests/modeltests/lookup/models.py
@@ -168,29 +168,29 @@ FieldError: Cannot resolve keyword 'id_plus_two' into field. Choices are: headli
>>> list(Article.objects.filter(id=5).values()) == [{'id': 5, 'headline': 'Article 5', 'pub_date': datetime(2005, 8, 1, 9, 0)}]
True
-# valueslist() is similar to values(), except that the results are returned as
+# values_list() is similar to values(), except that the results are returned as
# a list of tuples, rather than a list of dictionaries. Within each tuple, the
-# order of the elemnts is the same as the order of fields in the valueslist()
+# order of the elemnts is the same as the order of fields in the values_list()
# call.
->>> Article.objects.valueslist('headline')
+>>> Article.objects.values_list('headline')
[(u'Article 5',), (u'Article 6',), (u'Article 4',), (u'Article 2',), (u'Article 3',), (u'Article 7',), (u'Article 1',)]
->>> Article.objects.valueslist('id').order_by('id')
+>>> Article.objects.values_list('id').order_by('id')
[(1,), (2,), (3,), (4,), (5,), (6,), (7,)]
->>> Article.objects.valueslist('id', flat=True).order_by('id')
+>>> Article.objects.values_list('id', flat=True).order_by('id')
[1, 2, 3, 4, 5, 6, 7]
->>> Article.objects.extra(select={'id_plus_one': 'id+1'}).order_by('id').valueslist('id')
+>>> Article.objects.extra(select={'id_plus_one': 'id+1'}).order_by('id').values_list('id')
[(1,), (2,), (3,), (4,), (5,), (6,), (7,)]
->>> Article.objects.extra(select={'id_plus_one': 'id+1'}).order_by('id').valueslist('id_plus_one', 'id')
+>>> Article.objects.extra(select={'id_plus_one': 'id+1'}).order_by('id').values_list('id_plus_one', 'id')
[(2, 1), (3, 2), (4, 3), (5, 4), (6, 5), (7, 6), (8, 7)]
->>> Article.objects.extra(select={'id_plus_one': 'id+1'}).order_by('id').valueslist('id', 'id_plus_one')
+>>> Article.objects.extra(select={'id_plus_one': 'id+1'}).order_by('id').values_list('id', 'id_plus_one')
[(1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (6, 7), (7, 8)]
->>> Article.objects.valueslist('id', 'headline', flat=True)
+>>> Article.objects.values_list('id', 'headline', flat=True)
Traceback (most recent call last):
...
-TypeError: 'flat' is not valid when valueslist is called with more than one field.
+TypeError: 'flat' is not valid when values_list is called with more than one field.
# Every DateField and DateTimeField creates get_next_by_FOO() and
# get_previous_by_FOO() methods.