Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added documentation for the query kwargs introduced by [1534]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1536 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4ed3d57184169541f0ba55549759769020827bf8 1 parent 7dbff90
authored December 04, 2005

Showing 1 changed file with 45 additions and 39 deletions. Show diff stats Hide diff stats

  1. 84  docs/db-api.txt
84  docs/db-api.txt
@@ -152,45 +152,51 @@ translates (roughly) into the following SQL::
152 152
 
153 153
 The DB API supports the following lookup types:
154 154
 
155  
-    ===========  ==============================================================
156  
-    Type         Description
157  
-    ===========  ==============================================================
158  
-    exact        Exact match: ``polls.get_object(id__exact=14)``.
159  
-    iexact       Case-insensitive exact match:
160  
-                 ``polls.get_list(slug__iexact="foo")`` matches a slug of
161  
-                 ``foo``, ``FOO``, ``fOo``, etc.
162  
-    contains     Case-sensitive containment test:
163  
-                 ``polls.get_list(question__contains="spam")`` returns all polls
164  
-                 that contain "spam" in the question. (PostgreSQL and MySQL
165  
-                 only. SQLite doesn't support case-sensitive LIKE statements;
166  
-                 ``contains`` will act like ``icontains`` for SQLite.)
167  
-    icontains    Case-insensitive containment test.
168  
-    gt           Greater than: ``polls.get_list(id__gt=4)``.
169  
-    gte          Greater than or equal to.
170  
-    lt           Less than.
171  
-    lte          Less than or equal to.
172  
-    ne           Not equal to.
173  
-    in           In a given list: ``polls.get_list(id__in=[1, 3, 4])`` returns
174  
-                 a list of polls whose IDs are either 1, 3 or 4.
175  
-    startswith   Case-sensitive starts-with:
176  
-                 ``polls.get_list(question_startswith="Would")``. (PostgreSQL
177  
-                 and MySQL only. SQLite doesn't support case-sensitive LIKE
178  
-                 statements; ``startswith`` will act like ``istartswith`` for
179  
-                 SQLite.)
180  
-    endswith     Case-sensitive ends-with. (PostgreSQL and MySQL only.)
181  
-    istartswith  Case-insensitive starts-with.
182  
-    iendswith    Case-insensitive ends-with.
183  
-    range        Range test:
184  
-                 ``polls.get_list(pub_date__range=(start_date, end_date))``
185  
-                 returns all polls with a pub_date between ``start_date``
186  
-                 and ``end_date`` (inclusive).
187  
-    year         For date/datetime fields, exact year match:
188  
-                 ``polls.get_count(pub_date__year=2005)``.
189  
-    month        For date/datetime fields, exact month match.
190  
-    day          For date/datetime fields, exact day match.
191  
-    isnull       True/False; does is IF NULL/IF NOT NULL lookup:
192  
-                 ``polls.get_list(expire_date__isnull=True)``.
193  
-    ===========  ==============================================================
  155
+    =============  ==============================================================
  156
+    Type           Description
  157
+    =============  ==============================================================
  158
+    exact          Exact match: ``polls.get_object(id__exact=14)``.
  159
+    iexact         Case-insensitive exact match:
  160
+                   ``polls.get_list(slug__iexact="foo")`` matches a slug of
  161
+                   ``foo``, ``FOO``, ``fOo``, etc.
  162
+    contains       Case-sensitive containment test:
  163
+                   ``polls.get_list(question__contains="spam")`` returns all polls
  164
+                   that contain "spam" in the question. (PostgreSQL and MySQL
  165
+                   only. SQLite doesn't support case-sensitive LIKE statements;
  166
+                   ``contains`` will act like ``icontains`` for SQLite.)
  167
+    notcontains    negated ``contains``
  168
+    icontains      Case-insensitive containment test.
  169
+    inotcontains   negated ``icontains``
  170
+    gt             Greater than: ``polls.get_list(id__gt=4)``.
  171
+    gte            Greater than or equal to.
  172
+    lt             Less than.
  173
+    lte            Less than or equal to.
  174
+    ne             Not equal to.
  175
+    in             In a given list: ``polls.get_list(id__in=[1, 3, 4])`` returns
  176
+                   a list of polls whose IDs are either 1, 3 or 4.
  177
+    startswith     Case-sensitive starts-with:
  178
+                   ``polls.get_list(question_startswith="Would")``. (PostgreSQL
  179
+                   and MySQL only. SQLite doesn't support case-sensitive LIKE
  180
+                   statements; ``startswith`` will act like ``istartswith`` for
  181
+                   SQLite.)
  182
+    notstartswith  negated ``startswith``
  183
+    endswith       Case-sensitive ends-with. (PostgreSQL and MySQL only.)
  184
+    notendswith    negated ``endswith``
  185
+    istartswith    Case-insensitive starts-with.
  186
+    inotstartswith negated ``istartswith``
  187
+    iendswith      Case-insensitive ends-with.
  188
+    inotendswith   negated ``iendswith``
  189
+    range          Range test:
  190
+                   ``polls.get_list(pub_date__range=(start_date, end_date))``
  191
+                   returns all polls with a pub_date between ``start_date``
  192
+                   and ``end_date`` (inclusive).
  193
+    year           For date/datetime fields, exact year match:
  194
+                   ``polls.get_count(pub_date__year=2005)``.
  195
+    month          For date/datetime fields, exact month match.
  196
+    day            For date/datetime fields, exact day match.
  197
+    isnull         True/False; does is IF NULL/IF NOT NULL lookup:
  198
+                   ``polls.get_list(expire_date__isnull=True)``.
  199
+    =============  ==============================================================
194 200
 
195 201
 Multiple lookups are allowed, of course, and are translated as "AND"s::
196 202
 

0 notes on commit 4ed3d57

Please sign in to comment.
Something went wrong with that request. Please try again.