1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #11629 -- Deprecated callable arguments to queryset methods.

Callable arguments were an untested and undocumented feature.
This commit is contained in:
Baptiste Mispelon
2013-12-18 16:59:08 +01:00
parent d34c8c338a
commit f1b3ab9c21
4 changed files with 29 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ all about the internals of models in order to get the information it needs.
from collections import OrderedDict
import copy
import warnings
from django.utils.encoding import force_text
from django.utils.tree import Node
@@ -1036,6 +1037,9 @@ class Query(object):
lookup_type = 'isnull'
value = True
elif callable(value):
warnings.warn(
"Passing callable arguments to queryset is deprecated.",
PendingDeprecationWarning, stacklevel=2)
value = value()
elif isinstance(value, ExpressionNode):
# If value is a query expression, evaluate it