diff options
| author | Boulder Sprinters <boulder-sprinters@djangoproject.com> | 2006-12-28 17:17:52 +0000 |
|---|---|---|
| committer | Boulder Sprinters <boulder-sprinters@djangoproject.com> | 2006-12-28 17:17:52 +0000 |
| commit | 58ba520f32821140c96725b1f68ff31d64751844 (patch) | |
| tree | 0d13c17580762dd9cdea2a9c52350d946545113b /tests/modeltests/basic/models.py | |
| parent | f4aa4933226a78d04cdbfda9119e64212a80e5b7 (diff) | |
boulder-oracle-sprint: Merged to trunk [4253]
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@4254 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/basic/models.py')
| -rw-r--r-- | tests/modeltests/basic/models.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/modeltests/basic/models.py b/tests/modeltests/basic/models.py index ebf870ee12..2ebe857e7e 100644 --- a/tests/modeltests/basic/models.py +++ b/tests/modeltests/basic/models.py @@ -12,6 +12,9 @@ class Article(models.Model): class Meta: ordering = ('pub_date',) + class Meta: + ordering = ('pub_date','headline') + def __str__(self): return self.headline @@ -247,7 +250,7 @@ datetime.datetime(2005, 7, 28, 0, 0) # Slices (without step) are lazy: >>> Article.objects.all()[0:5].filter() -[<Article: Area woman programs in Python>, <Article: Second article>, <Article: Third article>, <Article: Fourth article>, <Article: Article 6>] +[<Article: Area woman programs in Python>, <Article: Second article>, <Article: Third article>, <Article: Article 6>, <Article: Default headline>] # Slicing again works: >>> Article.objects.all()[0:5][0:2] @@ -255,17 +258,17 @@ datetime.datetime(2005, 7, 28, 0, 0) >>> Article.objects.all()[0:5][:2] [<Article: Area woman programs in Python>, <Article: Second article>] >>> Article.objects.all()[0:5][4:] -[<Article: Article 6>] +[<Article: Default headline>] >>> Article.objects.all()[0:5][5:] [] # Some more tests! >>> Article.objects.all()[2:][0:2] -[<Article: Third article>, <Article: Fourth article>] +[<Article: Third article>, <Article: Article 6>] >>> Article.objects.all()[2:][:2] -[<Article: Third article>, <Article: Fourth article>] +[<Article: Third article>, <Article: Article 6>] >>> Article.objects.all()[2:][2:3] -[<Article: Article 6>] +[<Article: Default headline>] # Note that you can't use 'offset' without 'limit' (on some dbs), so this doesn't work: >>> Article.objects.all()[2:] @@ -314,7 +317,7 @@ AttributeError: Manager isn't accessible via Article instances # Bulk delete test: How many objects before and after the delete? >>> Article.objects.all() -[<Article: Area woman programs in Python>, <Article: Second article>, <Article: Third article>, <Article: Fourth article>, <Article: Article 6>, <Article: Default headline>, <Article: Article 7>, <Article: Updated article 8>] +[<Article: Area woman programs in Python>, <Article: Second article>, <Article: Third article>, <Article: Article 6>, <Article: Default headline>, <Article: Fourth article>, <Article: Article 7>, <Article: Updated article 8>] >>> Article.objects.filter(id__lte=4).delete() >>> Article.objects.all() [<Article: Article 6>, <Article: Default headline>, <Article: Article 7>, <Article: Updated article 8>] |
