mirror of
https://github.com/django/django.git
synced 2025-12-01 07:48:28 +00:00
Fixed #11629 -- Deprecated callable arguments to queryset methods.
Callable arguments were an untested and undocumented feature.
This commit is contained in:
parent
d34c8c338a
commit
f1b3ab9c21
4 changed files with 29 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue