summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2014-11-12 11:29:06 +0200
committerAnssi Kääriäinen <akaariai@gmail.com>2014-11-12 12:40:55 +0200
commitd647764a53a77be89c8d7239d70adcf8343d9f3a (patch)
tree59128ef8865ebb6b57bd3d5cee0aceeca7521696
parent3bc7a14ea52d916576b3d61dc6ba48b340a02671 (diff)
Improved Query.names_to_path docstring
-rw-r--r--django/db/models/sql/query.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 44420add01..b2528cad41 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1369,16 +1369,20 @@ class Query(object):
def names_to_path(self, names, opts, allow_many=True, fail_on_missing=False):
"""
- Walks the names path and turns them PathInfo tuples. Note that a
- single name in 'names' can generate multiple PathInfos (m2m for
+ Walks the list of names and turns them into PathInfo tuples. Note that
+ a single name in 'names' can generate multiple PathInfos (m2m for
example).
'names' is the path of names to travel, 'opts' is the model Options we
start the name resolving from, 'allow_many' is as for setup_joins().
+ If fail_on_missing is set to True, then a name that can't be resolved
+ will generate a FieldError.
Returns a list of PathInfo tuples. In addition returns the final field
(the last used join field), and target (which is a field guaranteed to
- contain the same value as the final field).
+ contain the same value as the final field). Finally, the method returns
+ those names that weren't found (which are likely transforms and the
+ final lookup).
"""
path, names_with_path = [], []
for pos, name in enumerate(names):