summaryrefslogtreecommitdiff
path: root/django/db/models/query.py
diff options
context:
space:
mode:
authorJason Pellerin <jpellerin@gmail.com>2006-11-29 20:16:50 +0000
committerJason Pellerin <jpellerin@gmail.com>2006-11-29 20:16:50 +0000
commitf8217026f9618adb65ab2d517025e87b98ed2fbe (patch)
tree2ab846582343dc9b0894b0bdffa3fe04f590365b /django/db/models/query.py
parent9a01534370a272e59f2bb64251d1f46218a32516 (diff)
[multi-db] Merge trunk to [3850]. Some tests still failing.
git-svn-id: http://code.djangoproject.com/svn/django/branches/multiple-db-support@4142 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/query.py')
-rw-r--r--django/db/models/query.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 78179244e6..f16e6869e3 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -732,14 +732,10 @@ def parse_lookup(kwarg_items, opts):
# Extract the last elements of the kwarg.
# The very-last is the lookup_type (equals, like, etc).
# The second-last is the table column on which the lookup_type is
- # to be performed.
- # The exceptions to this are:
- # 1) "pk", which is an implicit id__exact;
- # if we find "pk", make the lookup_type "exact', and insert
- # a dummy name of None, which we will replace when
- # we know which table column to grab as the primary key.
- # 2) If there is only one part, or the last part is not a query
- # term, assume that the query is an __exact
+ # to be performed. If this name is 'pk', it will be substituted with
+ # the name of the primary key.
+ # If there is only one part, or the last part is not a query
+ # term, assume that the query is an __exact
lookup_type = path.pop()
if lookup_type == 'pk':
lookup_type = 'exact'
@@ -789,7 +785,7 @@ def lookup_inner(path, lookup_type, value, opts, table, column):
name = path.pop(0)
# Has the primary key been requested? If so, expand it out
# to be the name of the current class' primary key
- if name is None:
+ if name is None or name == 'pk':
name = current_opts.pk.name
# Try to find the name in the fields associated with the current class