Loading django/db/models/sql/query.py +1 −6 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ from django.db.models.sql.datastructures import ( from django.db.models.sql.where import (WhereNode, Constraint, EverythingNode, ExtraWhere, AND, OR, EmptyWhere) from django.utils import six from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning from django.utils.encoding import force_text from django.utils.tree import Node Loading Loading @@ -973,11 +973,6 @@ class Query(object): raise ValueError("Cannot use None as a query value") lookups[-1] = 'isnull' value = True elif callable(value): warnings.warn( "Passing callable arguments to queryset is deprecated.", RemovedInDjango19Warning, stacklevel=2) value = value() elif hasattr(value, 'resolve_expression'): pre_joins = self.alias_refcount.copy() value = value.resolve_expression(self, reuse=can_reuse, allow_joins=allow_joins) Loading tests/queries/tests.py +0 −13 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ import datetime from operator import attrgetter import pickle import unittest import warnings from django.core.exceptions import FieldError from django.db import connection, DEFAULT_DB_ALIAS Loading @@ -15,7 +14,6 @@ from django.db.models.sql.constants import LOUTER from django.db.models.sql.datastructures import EmptyResultSet from django.test import TestCase, skipUnlessDBFeature from django.test.utils import CaptureQueriesContext from django.utils.deprecation import RemovedInDjango19Warning from django.utils import six from django.utils.six.moves import range Loading Loading @@ -1164,17 +1162,6 @@ class Queries1Tests(BaseQuerysetTest): ['<Author: a1>', '<Author: a2>', '<Author: a3>', '<Author: a4>'] ) def test_callable_args(self): with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') qs = Tag.objects.filter(name__startswith=lambda: 't') self.assertQuerysetEqual( qs, ['<Tag: t1>', '<Tag: t2>', '<Tag: t3>', '<Tag: t4>', '<Tag: t5>'] ) self.assertEqual(len(w), 1) self.assertTrue(issubclass(w[0].category, RemovedInDjango19Warning)) class Queries2Tests(TestCase): @classmethod Loading Loading
django/db/models/sql/query.py +1 −6 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ from django.db.models.sql.datastructures import ( from django.db.models.sql.where import (WhereNode, Constraint, EverythingNode, ExtraWhere, AND, OR, EmptyWhere) from django.utils import six from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning from django.utils.encoding import force_text from django.utils.tree import Node Loading Loading @@ -973,11 +973,6 @@ class Query(object): raise ValueError("Cannot use None as a query value") lookups[-1] = 'isnull' value = True elif callable(value): warnings.warn( "Passing callable arguments to queryset is deprecated.", RemovedInDjango19Warning, stacklevel=2) value = value() elif hasattr(value, 'resolve_expression'): pre_joins = self.alias_refcount.copy() value = value.resolve_expression(self, reuse=can_reuse, allow_joins=allow_joins) Loading
tests/queries/tests.py +0 −13 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ import datetime from operator import attrgetter import pickle import unittest import warnings from django.core.exceptions import FieldError from django.db import connection, DEFAULT_DB_ALIAS Loading @@ -15,7 +14,6 @@ from django.db.models.sql.constants import LOUTER from django.db.models.sql.datastructures import EmptyResultSet from django.test import TestCase, skipUnlessDBFeature from django.test.utils import CaptureQueriesContext from django.utils.deprecation import RemovedInDjango19Warning from django.utils import six from django.utils.six.moves import range Loading Loading @@ -1164,17 +1162,6 @@ class Queries1Tests(BaseQuerysetTest): ['<Author: a1>', '<Author: a2>', '<Author: a3>', '<Author: a4>'] ) def test_callable_args(self): with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') qs = Tag.objects.filter(name__startswith=lambda: 't') self.assertQuerysetEqual( qs, ['<Tag: t1>', '<Tag: t2>', '<Tag: t3>', '<Tag: t4>', '<Tag: t5>'] ) self.assertEqual(len(w), 1) self.assertTrue(issubclass(w[0].category, RemovedInDjango19Warning)) class Queries2Tests(TestCase): @classmethod Loading