diff options
| author | Tim Graham <timograham@gmail.com> | 2015-01-18 13:53:36 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-01-18 14:01:25 -0500 |
| commit | 2cd00424c4a14b04973629d9f027df5281806e15 (patch) | |
| tree | 7360ad3fd54981a7ab3c93ecc36989e0b26069f2 | |
| parent | 4548a282a1c64bb2ed414da3d08617d869cd3740 (diff) | |
Removed support for callable QuerySet arguments per deprecation timeline; refs #11629.
| -rw-r--r-- | django/db/models/sql/query.py | 7 | ||||
| -rw-r--r-- | tests/queries/tests.py | 13 |
2 files changed, 1 insertions, 19 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index c5e7eab28c..ace562a8fa 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -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 @@ -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) diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 92e5982e10..3044faea6e 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -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 @@ -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 @@ -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 |
