diff --git a/tests/modeltests/basic/models.py b/tests/modeltests/basic/models.py index 85ca1582b8..dd5a02be18 100644 --- a/tests/modeltests/basic/models.py +++ b/tests/modeltests/basic/models.py @@ -13,7 +13,7 @@ class Article(models.Model): API_TESTS = """ # No articles are in the system yet. ->>> list(Article.objects) +>>> list(Article.objects.all()) [] # Create an Article. @@ -40,7 +40,7 @@ datetime.datetime(2005, 7, 28, 0, 0) # Listing objects displays all the articles in the database. Note that the article # is represented by "
", because we haven't given the Article # model a __repr__() method. ->>> list(Article.objects) +>>> list(Article.objects.all()) [
] # Django provides a rich database lookup API that's entirely driven by @@ -222,9 +222,9 @@ AssertionError: 'order' must be either 'ASC' or 'DESC'. 1 # You can get items using index and slice notation. ->>> Article.objects[0] +>>> Article.objects.all()[0]
->>> Article.objects[1:2] +>>> Article.objects.all()[1:2] [
,
] >>> s3 = Article.objects.filter(id__exact=3) >>> (s1 | s2 | s3)[::2] @@ -232,7 +232,7 @@ AssertionError: 'order' must be either 'ASC' or 'DESC'. # An Article instance doesn't have access to the "objects" attribute. # That is only available as a class method. ->>> list(a7.objects) +>>> a7.objects.all() Traceback (most recent call last): ... AttributeError: Manager isn't accessible via Article instances diff --git a/tests/modeltests/custom_columns/models.py b/tests/modeltests/custom_columns/models.py index 03da185586..3cbd5639f4 100644 --- a/tests/modeltests/custom_columns/models.py +++ b/tests/modeltests/custom_columns/models.py @@ -23,7 +23,7 @@ API_TESTS = """ >>> p.id 1 ->>> list(Person.objects) +>>> list(Person.objects.all()) [John Smith] >>> list(Person.objects.filter(first_name__exact='John')) diff --git a/tests/modeltests/custom_pk/models.py b/tests/modeltests/custom_pk/models.py index aa22432e5c..9d3641b84a 100644 --- a/tests/modeltests/custom_pk/models.py +++ b/tests/modeltests/custom_pk/models.py @@ -29,12 +29,12 @@ class Business(models.Model): API_TESTS = """ >>> dan = Employee(employee_code='ABC123', first_name='Dan', last_name='Jones') >>> dan.save() ->>> list(Employee.objects) +>>> list(Employee.objects.all()) [Dan Jones] >>> fran = Employee(employee_code='XYZ456', first_name='Fran', last_name='Bones') >>> fran.save() ->>> list(Employee.objects) +>>> list(Employee.objects.all()) [Fran Bones, Dan Jones] >>> Employee.objects.get(pk='ABC123') diff --git a/tests/modeltests/manipulators/models.py b/tests/modeltests/manipulators/models.py index 902940ded6..b1268ebc4c 100644 --- a/tests/modeltests/manipulators/models.py +++ b/tests/modeltests/manipulators/models.py @@ -32,9 +32,9 @@ API_TESTS = """ >>> m1 = man.save(data) # Verify it worked. ->>> list(Musician.objects) +>>> list(Musician.objects.all()) [Ella Fitzgerald] ->>> [m1] == list(Musician.objects) +>>> [m1] == list(Musician.objects.all()) True # Attempt to add a Musician without a first_name. @@ -66,7 +66,7 @@ True >>> a1 = man.save(data) # Verify it worked. ->>> list(Album.objects) +>>> list(Album.objects.all()) [Ella and Basie] >>> Album.objects.get().musician Ella Fitzgerald @@ -79,7 +79,7 @@ Ella Fitzgerald >>> a2 = man.save(data) # Verify it worked. ->>> list(Album.objects.filter(order_by=['name'])) +>>> list(Album.objects.order_by('name')) [Ella and Basie, Ultimate Ella] >>> a2 = Album.objects.get(pk=2) >>> a2 diff --git a/tests/modeltests/many_to_many/models.py b/tests/modeltests/many_to_many/models.py index ef64455910..05ddab6ae9 100644 --- a/tests/modeltests/many_to_many/models.py +++ b/tests/modeltests/many_to_many/models.py @@ -96,7 +96,7 @@ True # If we delete a Publication, its Articles won't be able to access it. >>> p1.delete() ->>> list(Publication.objects) +>>> list(Publication.objects.all()) [Science News, Science Weekly] >>> a1 = Article.objects.get(pk=1) >>> list(a1.publication_set) @@ -104,7 +104,7 @@ True # If we delete an Article, its Publications won't be able to access it. >>> a2.delete() ->>> list(Article.objects) +>>> list(Article.objects.all()) [Django lets you build Web apps easily] >>> list(p1.article_set.order_by('headline')) [Django lets you build Web apps easily] diff --git a/tests/modeltests/one_to_one/models.py b/tests/modeltests/one_to_one/models.py index c14f46f6fa..a903d00a6b 100644 --- a/tests/modeltests/one_to_one/models.py +++ b/tests/modeltests/one_to_one/models.py @@ -56,12 +56,12 @@ Traceback (most recent call last): DoesNotExist: Restaurant does not exist for {'place__id__exact': ...} # Restaurant.objects.get_list() just returns the Restaurants, not the Places. ->>> list(Restaurant.objects) +>>> list(Restaurant.objects.all()) [Demon Dogs the restaurant] # Place.objects.get_list() returns all Places, regardless of whether they have # Restaurants. ->>> list(Place.objects.filter(order_by=['name'])) +>>> list(Place.objects.order_by('name')) [Ace Hardware the place, Demon Dogs the place] >>> Restaurant.objects.get(place__id__exact=1) diff --git a/tests/modeltests/ordering/models.py b/tests/modeltests/ordering/models.py index b42189daa5..aa4572de22 100644 --- a/tests/modeltests/ordering/models.py +++ b/tests/modeltests/ordering/models.py @@ -36,9 +36,9 @@ API_TESTS = """ >>> a4 = Article(headline='Article 4', pub_date=datetime(2005, 7, 28)) >>> a4.save() -# By default, articles.get_list() orders by pub_date descending, then +# By default, Article.objects.all() orders by pub_date descending, then # headline ascending. ->>> list(Article.objects) +>>> list(Article.objects.all()) [Article 4, Article 2, Article 3, Article 1] # Override ordering with order_by, which is in the same format as the ordering diff --git a/tests/modeltests/save_delete_hooks/models.py b/tests/modeltests/save_delete_hooks/models.py index 8e038c7647..65817045a8 100644 --- a/tests/modeltests/save_delete_hooks/models.py +++ b/tests/modeltests/save_delete_hooks/models.py @@ -30,13 +30,13 @@ API_TESTS = """ Before save After save ->>> list(Person.objects) +>>> list(Person.objects.all()) [John Smith] >>> p1.delete() Before deletion After deletion ->>> list(Person.objects) +>>> list(Person.objects.all()) [] """