Loading django/db/models/sql/compiler.py +0 −2 Original line number Diff line number Diff line Loading @@ -363,8 +363,6 @@ class SQLCompiler(object): If 'with_limits' is False, any limit/offset information is not included in the query. """ if with_limits and self.query.low_mark == self.query.high_mark: return '', () self.subquery = subquery refcounts_before = self.query.alias_refcount.copy() try: Loading docs/releases/1.9.1.txt +3 −0 Original line number Diff line number Diff line Loading @@ -37,3 +37,6 @@ Bugfixes * Prevented ``QuerySet.delete()`` from crashing on MySQL when querying across relations (:ticket`25882`). * Fixed evaluation of zero-length slices of ``QuerySet.values()`` (:ticket:`25894`). tests/queries/tests.py +6 −0 Original line number Diff line number Diff line Loading @@ -2429,6 +2429,12 @@ class WeirdQuerysetSlicingTests(BaseQuerysetTest): def test_empty_sliced_subquery_exclude(self): self.assertEqual(Eaten.objects.exclude(food__in=Food.objects.all()[0:0]).count(), 1) def test_zero_length_values_slicing(self): n = 42 with self.assertNumQueries(0): self.assertQuerysetEqual(Article.objects.values()[n:n], []) self.assertQuerysetEqual(Article.objects.values_list()[n:n], []) class EscapingTests(TestCase): def test_ticket_7302(self): Loading Loading
django/db/models/sql/compiler.py +0 −2 Original line number Diff line number Diff line Loading @@ -363,8 +363,6 @@ class SQLCompiler(object): If 'with_limits' is False, any limit/offset information is not included in the query. """ if with_limits and self.query.low_mark == self.query.high_mark: return '', () self.subquery = subquery refcounts_before = self.query.alias_refcount.copy() try: Loading
docs/releases/1.9.1.txt +3 −0 Original line number Diff line number Diff line Loading @@ -37,3 +37,6 @@ Bugfixes * Prevented ``QuerySet.delete()`` from crashing on MySQL when querying across relations (:ticket`25882`). * Fixed evaluation of zero-length slices of ``QuerySet.values()`` (:ticket:`25894`).
tests/queries/tests.py +6 −0 Original line number Diff line number Diff line Loading @@ -2429,6 +2429,12 @@ class WeirdQuerysetSlicingTests(BaseQuerysetTest): def test_empty_sliced_subquery_exclude(self): self.assertEqual(Eaten.objects.exclude(food__in=Food.objects.all()[0:0]).count(), 1) def test_zero_length_values_slicing(self): n = 42 with self.assertNumQueries(0): self.assertQuerysetEqual(Article.objects.values()[n:n], []) self.assertQuerysetEqual(Article.objects.values_list()[n:n], []) class EscapingTests(TestCase): def test_ticket_7302(self): Loading