diff -r 611e264b0305 django/db/models/sql/query.py
a
|
b
|
|
332 | 332 | # in SQL (in variants that provide them) doesn't change the COUNT |
333 | 333 | # output. |
334 | 334 | number = max(0, number - self.low_mark) |
335 | | if self.high_mark: |
| 335 | if self.high_mark is not None: |
336 | 336 | number = min(number, self.high_mark - self.low_mark) |
337 | 337 | |
338 | 338 | return number |
… |
… |
|
1733 | 1733 | |
1734 | 1734 | Typically, this means no limits or offsets have been put on the results. |
1735 | 1735 | """ |
1736 | | return not (self.low_mark or self.high_mark) |
| 1736 | return not self.low_mark and self.high_mark is None |
1737 | 1737 | |
1738 | 1738 | def clear_select_fields(self): |
1739 | 1739 | """ |
diff -r 611e264b0305 tests/regressiontests/queries/models.py
a
|
b
|
|
877 | 877 | >>> Item.objects.filter(created__in=[time1, time2]) |
878 | 878 | [<Item: one>, <Item: two>] |
879 | 879 | |
880 | | Bug #7698 -- People like to slice with '0' as the high-water mark. |
| 880 | Bug #7698, #10202 -- People like to slice with '0' as the high-water mark. |
881 | 881 | >>> Item.objects.all()[0:0] |
882 | 882 | [] |
883 | 883 | >>> Item.objects.all()[0:0][:10] |
884 | 884 | [] |
| 885 | >>> Item.objects.all()[:0].count() |
| 886 | 0 |
| 887 | >>> Item.objects.all()[:0].latest('created') |
| 888 | Traceback (most recent call last): |
| 889 | ... |
| 890 | AssertionError: Cannot change a query once a slice has been taken. |
885 | 891 | |
886 | 892 | Bug #7411 - saving to db must work even with partially read result set in |
887 | 893 | another cursor. |