mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
magic-removal: Fixed #1186 -- Fixed problem resolving primary key in some 'pk' database queries. Also lightly refactored query-parsing code. Thanks, Russ
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1856 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -68,6 +68,8 @@ True
|
||||
[Django lets you build Web apps easily, NASA uses Python]
|
||||
|
||||
# We can perform kwarg queries across m2m relationships
|
||||
>>> Article.objects.get_list(publications__id__exact=1)
|
||||
[Django lets you build Web apps easily, NASA uses Python]
|
||||
>>> Article.objects.get_list(publications__pk=1)
|
||||
[Django lets you build Web apps easily, NASA uses Python]
|
||||
|
||||
@@ -78,9 +80,17 @@ True
|
||||
[NASA uses Python]
|
||||
|
||||
# Reverse m2m queries (i.e., start at the table that doesn't have a ManyToManyField)
|
||||
>>> Publication.objects.get_list(id__exact=1)
|
||||
[The Python Journal]
|
||||
>>> Publication.objects.get_list(pk=1)
|
||||
[The Python Journal]
|
||||
|
||||
>>> Publication.objects.get_list(articles__headline__startswith="NASA")
|
||||
[The Python Journal, Science News, Science Weekly]
|
||||
|
||||
>>> Publication.objects.get_list(articles__id__exact=1)
|
||||
[The Python Journal]
|
||||
|
||||
>>> Publication.objects.get_list(articles__pk=1)
|
||||
[The Python Journal]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user