1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Added a note about queryset.query being opaque.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8955 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2008-09-03 21:47:57 +00:00
parent 9d407fb5e8
commit 7c2e2d2b5e

View File

@ -939,7 +939,14 @@ instead of providing a list of literal values. The queryset must be
reduced to a list of individual values using the ``values()`` method,
and then converted into a query using the ``query`` attribute::
Entry.objects.filter(blog__in=Blog.objects.filter(name__contains='Cheddar').values('pk').query)
q = Blog.objects.filter(name__contains='Cheddar').values('pk').query
e = Entry.objects.filter(blog__in=q)
.. warning::
This ``query`` attribute should be considered an opaque internal attribute.
It's fine to use it like above, but its API may change between Django
versions.
This queryset will be evaluated as subselect statement::
@ -973,19 +980,6 @@ lte
Less than or equal to.
in
~~
In a given list.
Example::
Entry.objects.filter(id__in=[1, 3, 4])
SQL equivalent::
SELECT ... WHERE id IN (1, 3, 4);
startswith
~~~~~~~~~~