summaryrefslogtreecommitdiff
path: root/tests/modeltests/custom_pk
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2006-09-25 13:49:01 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2006-09-25 13:49:01 +0000
commit0c41869e6ccf779e19032dede71a627c4370b68a (patch)
tree06dcb029e3a98afc346c166ce291e6cedf73f936 /tests/modeltests/custom_pk
parentf6ec6d24ab0d11b8ce3cdc0fbe6bfab5cee6407e (diff)
Made ``pk`` a generic expansion for the primary key, rather than just an expansion for __id__exact.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3826 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/custom_pk')
-rw-r--r--tests/modeltests/custom_pk/models.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/modeltests/custom_pk/models.py b/tests/modeltests/custom_pk/models.py
index ca788f6aa5..fd0901da3c 100644
--- a/tests/modeltests/custom_pk/models.py
+++ b/tests/modeltests/custom_pk/models.py
@@ -51,6 +51,10 @@ DoesNotExist: Employee matching query does not exist.
>>> Employee.objects.get(employee_code__exact='ABC123')
<Employee: Dan Jones>
+# pk can be used as a substitute for the primary key.
+>>> Employee.objects.filter(pk__in=['ABC123','XYZ456'])
+[<Employee: Fran Bones>, <Employee: Dan Jones>]
+
# Fran got married and changed her last name.
>>> fran = Employee.objects.get(pk='XYZ456')
>>> fran.last_name = 'Jones'