Changeset 4228
- Timestamp:
- 12/18/06 21:38:38 (2 years ago)
- Files:
-
- django/trunk/tests/modeltests/basic/models.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/tests/modeltests/basic/models.py
r3826 r4228 11 11 pub_date = models.DateTimeField() 12 12 13 class Meta: 14 ordering = ('pub_date','headline') 15 13 16 def __str__(self): 14 17 return self.headline … … 246 249 # Slices (without step) are lazy: 247 250 >>> Article.objects.all()[0:5].filter() 248 [<Article: Area woman programs in Python>, <Article: Second article>, <Article: Third article>, <Article: Fourth article>, <Article: Article 6>]251 [<Article: Area woman programs in Python>, <Article: Second article>, <Article: Third article>, <Article: Article 6>, <Article: Default headline>] 249 252 250 253 # Slicing again works: … … 254 257 [<Article: Area woman programs in Python>, <Article: Second article>] 255 258 >>> Article.objects.all()[0:5][4:] 256 [<Article: Article 6>]259 [<Article: Default headline>] 257 260 >>> Article.objects.all()[0:5][5:] 258 261 [] … … 260 263 # Some more tests! 261 264 >>> Article.objects.all()[2:][0:2] 262 [<Article: Third article>, <Article: Fourth article>]265 [<Article: Third article>, <Article: Article 6>] 263 266 >>> Article.objects.all()[2:][:2] 264 [<Article: Third article>, <Article: Fourth article>]267 [<Article: Third article>, <Article: Article 6>] 265 268 >>> Article.objects.all()[2:][2:3] 266 [<Article: Article 6>]269 [<Article: Default headline>] 267 270 268 271 # Note that you can't use 'offset' without 'limit' (on some dbs), so this doesn't work: … … 313 316 # Bulk delete test: How many objects before and after the delete? 314 317 >>> Article.objects.all() 315 [<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>]318 [<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>] 316 319 >>> Article.objects.filter(id__lte=4).delete() 317 320 >>> Article.objects.all()
