Moved misplaced documentation warning note about internal QuerySet query atribute.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17342 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
8312b85c97
commit
33f839b252
|
@ -1752,6 +1752,12 @@ The above code fragment could also be written as follows::
|
||||||
inner_q = Blog.objects.filter(name__contains='Cheddar').values('pk').query
|
inner_q = Blog.objects.filter(name__contains='Cheddar').values('pk').query
|
||||||
entries = Entry.objects.filter(blog__in=inner_q)
|
entries = Entry.objects.filter(blog__in=inner_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 second form is a bit less readable and unnatural to write, since it
|
This second form is a bit less readable and unnatural to write, since it
|
||||||
accesses the internal ``query`` attribute and requires a ``ValuesQuerySet``.
|
accesses the internal ``query`` attribute and requires a ``ValuesQuerySet``.
|
||||||
If your code doesn't require compatibility with Django 1.0, use the first
|
If your code doesn't require compatibility with Django 1.0, use the first
|
||||||
|
@ -1772,12 +1778,6 @@ extract two field values, where only one is expected::
|
||||||
inner_qs = Blog.objects.filter(name__contains='Ch').values('name', 'id')
|
inner_qs = Blog.objects.filter(name__contains='Ch').values('name', 'id')
|
||||||
entries = Entry.objects.filter(blog__name__in=inner_qs)
|
entries = Entry.objects.filter(blog__name__in=inner_qs)
|
||||||
|
|
||||||
.. 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.
|
|
||||||
|
|
||||||
.. admonition:: Performance considerations
|
.. admonition:: Performance considerations
|
||||||
|
|
||||||
Be cautious about using nested queries and understand your database
|
Be cautious about using nested queries and understand your database
|
||||||
|
|
Loading…
Reference in New Issue