Django

Code

Changeset 8955

Show
Ignore:
Timestamp:
09/03/08 16:47:57 (10 months ago)
Author:
jacob
Message:

Added a note about queryset.query being opaque.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/ref/models/querysets.txt

    r8947 r8955  
    940940and then converted into a query using the ``query`` attribute:: 
    941941 
    942     Entry.objects.filter(blog__in=Blog.objects.filter(name__contains='Cheddar').values('pk').query) 
     942    q = Blog.objects.filter(name__contains='Cheddar').values('pk').query 
     943    e = Entry.objects.filter(blog__in=q) 
     944 
     945.. warning:: 
     946 
     947    This ``query`` attribute should be considered an opaque internal attribute. 
     948    It's fine to use it like above, but its API may change between Django 
     949    versions. 
    943950 
    944951This queryset will be evaluated as subselect statement:: 
     
    973980 
    974981Less than or equal to. 
    975  
    976 in 
    977 ~~ 
    978  
    979 In a given list. 
    980  
    981 Example:: 
    982  
    983     Entry.objects.filter(id__in=[1, 3, 4]) 
    984  
    985 SQL equivalent:: 
    986  
    987     SELECT ... WHERE id IN (1, 3, 4); 
    988982 
    989983startswith