diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2007-08-17 15:05:54 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2007-08-17 15:05:54 +0000 |
| commit | fcec755f01cfaba2a85bfc9511876debbce98631 (patch) | |
| tree | e990effbcd90e4d405b0f9dcc70cb38e47b6f3dc /tests/modeltests/basic/models.py | |
| parent | 0f92ac52cbf81fb2ac01755c558e2e6ad54700e8 (diff) | |
newforms-admin: Merged from trunk up to [5916]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@5918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/basic/models.py')
| -rw-r--r-- | tests/modeltests/basic/models.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/modeltests/basic/models.py b/tests/modeltests/basic/models.py index d2220320a0..0a09579761 100644 --- a/tests/modeltests/basic/models.py +++ b/tests/modeltests/basic/models.py @@ -247,6 +247,19 @@ datetime.datetime(2005, 7, 28, 0, 0) >>> (s1 | s2 | s3)[::2] [<Article: Area woman programs in Python>, <Article: Third article>] +# Slicing works with longs. +>>> Article.objects.all()[0L] +<Article: Area woman programs in Python> +>>> Article.objects.all()[1L:3L] +[<Article: Second article>, <Article: Third article>] +>>> s3 = Article.objects.filter(id__exact=3) +>>> (s1 | s2 | s3)[::2L] +[<Article: Area woman programs in Python>, <Article: Third article>] + +# And can be mixed with ints. +>>> Article.objects.all()[1:3L] +[<Article: Second article>, <Article: Third article>] + # Slices (without step) are lazy: >>> Article.objects.all()[0:5].filter() [<Article: Area woman programs in Python>, <Article: Second article>, <Article: Third article>, <Article: Article 6>, <Article: Default headline>] |
