mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #163 -- Added 'pk' database API option, which is a shorthand for (primary_key)__exact
git-svn-id: http://code.djangoproject.com/svn/django/trunk@316 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1146,6 +1146,9 @@ def _parse_lookup(kwarg_items, opts, table_count=0):
|
||||
params.extend(params2)
|
||||
continue
|
||||
lookup_list = kwarg.split(LOOKUP_SEPARATOR)
|
||||
# pk="value" is shorthand for (primary key)__exact="value"
|
||||
if lookup_list[-1] == 'pk':
|
||||
lookup_list = lookup_list[:-1] + [opts.pk.name, 'exact']
|
||||
if len(lookup_list) == 1:
|
||||
_throw_bad_kwarg_error(kwarg)
|
||||
lookup_type = lookup_list.pop()
|
||||
|
||||
Reference in New Issue
Block a user