diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
a
|
b
|
|
134 | 134 | ``filter(**kwargs)`` |
135 | 135 | ~~~~~~~~~~~~~~~~~~~~ |
136 | 136 | |
| 137 | .. method:: filter(**kwargs) |
| 138 | |
137 | 139 | Returns a new ``QuerySet`` containing objects that match the given lookup |
138 | 140 | parameters. |
139 | 141 | |
… |
… |
|
144 | 146 | ``exclude(**kwargs)`` |
145 | 147 | ~~~~~~~~~~~~~~~~~~~~~ |
146 | 148 | |
| 149 | .. method:: exclude(**kwargs) |
| 150 | |
147 | 151 | Returns a new ``QuerySet`` containing objects that do *not* match the given |
148 | 152 | lookup parameters. |
149 | 153 | |
… |
… |
|
177 | 181 | ``annotate(*args, **kwargs)`` |
178 | 182 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
179 | 183 | |
| 184 | .. method:: annotate(*args, **kwargs) |
| 185 | |
180 | 186 | .. versionadded:: 1.1 |
181 | 187 | |
182 | 188 | Annotates each object in the ``QuerySet`` with the provided list of |
… |
… |
|
219 | 225 | ``order_by(*fields)`` |
220 | 226 | ~~~~~~~~~~~~~~~~~~~~~ |
221 | 227 | |
| 228 | .. method:: order_by(*fields) |
| 229 | |
222 | 230 | By default, results returned by a ``QuerySet`` are ordered by the ordering |
223 | 231 | tuple given by the ``ordering`` option in the model's ``Meta``. You can |
224 | 232 | override this on a per-``QuerySet`` basis by using the ``order_by`` method. |
… |
… |
|
293 | 301 | ``reverse()`` |
294 | 302 | ~~~~~~~~~~~~~ |
295 | 303 | |
| 304 | .. method:: reverse() |
| 305 | |
296 | 306 | .. versionadded:: 1.0 |
297 | 307 | |
298 | 308 | Use the ``reverse()`` method to reverse the order in which a queryset's |
… |
… |
|
323 | 333 | ``distinct()`` |
324 | 334 | ~~~~~~~~~~~~~~ |
325 | 335 | |
| 336 | .. method:: distinct() |
| 337 | |
326 | 338 | Returns a new ``QuerySet`` that uses ``SELECT DISTINCT`` in its SQL query. This |
327 | 339 | eliminates duplicate rows from the query results. |
328 | 340 | |
… |
… |
|
357 | 369 | ``values(*fields)`` |
358 | 370 | ~~~~~~~~~~~~~~~~~~~ |
359 | 371 | |
| 372 | .. method:: values(*fields) |
| 373 | |
360 | 374 | Returns a ``ValuesQuerySet`` -- a ``QuerySet`` that returns dictionaries when |
361 | 375 | used as an iterable, rather than model-instance objects. |
362 | 376 | |
… |
… |
|
440 | 454 | ``values_list(*fields)`` |
441 | 455 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
442 | 456 | |
| 457 | .. method:: values_list(*fields) |
| 458 | |
443 | 459 | .. versionadded:: 1.0 |
444 | 460 | |
445 | 461 | This is similar to ``values()`` except that instead of returning dictionaries, |
… |
… |
|
468 | 484 | ``dates(field, kind, order='ASC')`` |
469 | 485 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
470 | 486 | |
| 487 | .. method:: dates(field, kind, order='ASC') |
| 488 | |
471 | 489 | Returns a ``DateQuerySet`` -- a ``QuerySet`` that evaluates to a list of |
472 | 490 | ``datetime.datetime`` objects representing all available dates of a particular |
473 | 491 | kind within the contents of the ``QuerySet``. |
… |
… |
|
502 | 520 | ``none()`` |
503 | 521 | ~~~~~~~~~~ |
504 | 522 | |
| 523 | .. method:: none() |
| 524 | |
505 | 525 | .. versionadded:: 1.0 |
506 | 526 | |
507 | 527 | Returns an ``EmptyQuerySet`` -- a ``QuerySet`` that always evaluates to |
… |
… |
|
515 | 535 | [] |
516 | 536 | |
517 | 537 | ``all()`` |
518 | | ~~~~~~~~~~ |
| 538 | ~~~~~~~~~ |
| 539 | |
| 540 | .. method:: all() |
519 | 541 | |
520 | 542 | .. versionadded:: 1.0 |
521 | 543 | |
… |
… |
|
530 | 552 | ``select_related()`` |
531 | 553 | ~~~~~~~~~~~~~~~~~~~~ |
532 | 554 | |
| 555 | .. method:: select_related() |
| 556 | |
533 | 557 | Returns a ``QuerySet`` that will automatically "follow" foreign-key |
534 | 558 | relationships, selecting that additional related-object data when it executes |
535 | 559 | its query. This is a performance booster which results in (sometimes much) |
… |
… |
|
639 | 663 | ``extra(select=None, where=None, params=None, tables=None, order_by=None, select_params=None)`` |
640 | 664 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
641 | 665 | |
| 666 | .. method:: extra(select=None, where=None, params=None, tables=None, order_by=None, select_params=None) |
| 667 | |
642 | 668 | Sometimes, the Django query syntax by itself can't easily express a complex |
643 | 669 | ``WHERE`` clause. For these edge cases, Django provides the ``extra()`` |
644 | 670 | ``QuerySet`` modifier -- a hook for injecting specific clauses into the SQL |
… |
… |
|
801 | 827 | ``defer(*fields)`` |
802 | 828 | ~~~~~~~~~~~~~~~~~~ |
803 | 829 | |
| 830 | .. method:: defer(*fields) |
| 831 | |
804 | 832 | .. versionadded:: 1.1 |
805 | 833 | |
806 | 834 | In some complex data-modeling situations, your models might contain a lot of |
… |
… |
|
857 | 885 | settled down and you understand where the hot-points are. |
858 | 886 | |
859 | 887 | ``only(*fields)`` |
860 | | ~~~~~~~~~~~~~~~~~~ |
| 888 | ~~~~~~~~~~~~~~~~~ |
| 889 | |
| 890 | .. method:: only(*fields) |
861 | 891 | |
862 | 892 | .. versionadded:: 1.1 |
863 | 893 | |
… |
… |
|
907 | 937 | ``get(**kwargs)`` |
908 | 938 | ~~~~~~~~~~~~~~~~~ |
909 | 939 | |
| 940 | .. method:: get(**kwargs) |
| 941 | |
910 | 942 | Returns the object matching the given lookup parameters, which should be in |
911 | 943 | the format described in `Field lookups`_. |
912 | 944 | |
… |
… |
|
934 | 966 | ``create(**kwargs)`` |
935 | 967 | ~~~~~~~~~~~~~~~~~~~~ |
936 | 968 | |
| 969 | .. method:: create(**kwargs) |
| 970 | |
937 | 971 | A convenience method for creating an object and saving it all in one step. Thus:: |
938 | 972 | |
939 | 973 | p = Person.objects.create(first_name="Bruce", last_name="Springsteen") |
… |
… |
|
956 | 990 | ``get_or_create(**kwargs)`` |
957 | 991 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
958 | 992 | |
| 993 | .. method:: get_or_create(**kwargs) |
| 994 | |
959 | 995 | A convenience method for looking up an object with the given kwargs, creating |
960 | 996 | one if necessary. |
961 | 997 | |
… |
… |
|
1024 | 1060 | ``count()`` |
1025 | 1061 | ~~~~~~~~~~~ |
1026 | 1062 | |
| 1063 | .. method:: count() |
| 1064 | |
1027 | 1065 | Returns an integer representing the number of objects in the database matching |
1028 | 1066 | the ``QuerySet``. ``count()`` never raises exceptions. |
1029 | 1067 | |
… |
… |
|
1047 | 1085 | ``in_bulk(id_list)`` |
1048 | 1086 | ~~~~~~~~~~~~~~~~~~~~ |
1049 | 1087 | |
| 1088 | .. method:: in_bulk(id_list) |
| 1089 | |
1050 | 1090 | Takes a list of primary-key values and returns a dictionary mapping each |
1051 | 1091 | primary-key value to an instance of the object with the given ID. |
1052 | 1092 | |
… |
… |
|
1066 | 1106 | ``iterator()`` |
1067 | 1107 | ~~~~~~~~~~~~~~ |
1068 | 1108 | |
| 1109 | .. method:: iterator() |
| 1110 | |
1069 | 1111 | Evaluates the ``QuerySet`` (by performing the query) and returns an |
1070 | 1112 | `iterator`_ over the results. A ``QuerySet`` typically caches its |
1071 | 1113 | results internally so that repeated evaluations do not result in |
… |
… |
|
1082 | 1124 | ``latest(field_name=None)`` |
1083 | 1125 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1084 | 1126 | |
| 1127 | .. method:: latest(field_name=None) |
| 1128 | |
1085 | 1129 | Returns the latest object in the table, by date, using the ``field_name`` |
1086 | 1130 | provided as the date field. |
1087 | 1131 | |
… |
… |
|
1102 | 1146 | ``aggregate(*args, **kwargs)`` |
1103 | 1147 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1104 | 1148 | |
| 1149 | .. method:: aggregate(*args, **kwargs) |
| 1150 | |
1105 | 1151 | .. versionadded:: 1.1 |
1106 | 1152 | |
1107 | 1153 | Returns a dictionary of aggregate values (averages, sums, etc) calculated |
… |
… |
|
1330 | 1376 | |
1331 | 1377 | SELECT ... WHERE id > 4; |
1332 | 1378 | |
1333 | | .. fieldlookup:: gte |
| 1379 | .. fieldlookup:: gte |
1334 | 1380 | |
1335 | 1381 | gte |
1336 | 1382 | ~~~ |