diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
a
|
b
|
|
138 | 138 | ``filter(**kwargs)`` |
139 | 139 | ~~~~~~~~~~~~~~~~~~~~ |
140 | 140 | |
| 141 | .. method:: filter(**kwargs) |
| 142 | |
141 | 143 | Returns a new ``QuerySet`` containing objects that match the given lookup |
142 | 144 | parameters. |
143 | 145 | |
… |
… |
|
148 | 150 | ``exclude(**kwargs)`` |
149 | 151 | ~~~~~~~~~~~~~~~~~~~~~ |
150 | 152 | |
| 153 | .. method:: exclude(**kwargs) |
| 154 | |
151 | 155 | Returns a new ``QuerySet`` containing objects that do *not* match the given |
152 | 156 | lookup parameters. |
153 | 157 | |
… |
… |
|
181 | 185 | ``annotate(*args, **kwargs)`` |
182 | 186 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
183 | 187 | |
| 188 | .. method:: annotate(*args, **kwargs) |
| 189 | |
184 | 190 | .. versionadded:: 1.1 |
185 | 191 | |
186 | 192 | Annotates each object in the ``QuerySet`` with the provided list of |
… |
… |
|
223 | 229 | ``order_by(*fields)`` |
224 | 230 | ~~~~~~~~~~~~~~~~~~~~~ |
225 | 231 | |
| 232 | .. method:: order_by(*fields) |
| 233 | |
226 | 234 | By default, results returned by a ``QuerySet`` are ordered by the ordering |
227 | 235 | tuple given by the ``ordering`` option in the model's ``Meta``. You can |
228 | 236 | override this on a per-``QuerySet`` basis by using the ``order_by`` method. |
… |
… |
|
297 | 305 | ``reverse()`` |
298 | 306 | ~~~~~~~~~~~~~ |
299 | 307 | |
| 308 | .. method:: reverse() |
| 309 | |
300 | 310 | .. versionadded:: 1.0 |
301 | 311 | |
302 | 312 | Use the ``reverse()`` method to reverse the order in which a queryset's |
… |
… |
|
327 | 337 | ``distinct()`` |
328 | 338 | ~~~~~~~~~~~~~~ |
329 | 339 | |
| 340 | .. method:: distinct() |
| 341 | |
330 | 342 | Returns a new ``QuerySet`` that uses ``SELECT DISTINCT`` in its SQL query. This |
331 | 343 | eliminates duplicate rows from the query results. |
332 | 344 | |
… |
… |
|
361 | 373 | ``values(*fields)`` |
362 | 374 | ~~~~~~~~~~~~~~~~~~~ |
363 | 375 | |
| 376 | .. method:: values(*fields) |
| 377 | |
364 | 378 | Returns a ``ValuesQuerySet`` -- a ``QuerySet`` that returns dictionaries when |
365 | 379 | used as an iterable, rather than model-instance objects. |
366 | 380 | |
… |
… |
|
444 | 458 | ``values_list(*fields)`` |
445 | 459 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
446 | 460 | |
| 461 | .. method:: values_list(*fields) |
| 462 | |
447 | 463 | .. versionadded:: 1.0 |
448 | 464 | |
449 | 465 | This is similar to ``values()`` except that instead of returning dictionaries, |
… |
… |
|
472 | 488 | ``dates(field, kind, order='ASC')`` |
473 | 489 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
474 | 490 | |
| 491 | .. method:: dates(field, kind, order='ASC') |
| 492 | |
475 | 493 | Returns a ``DateQuerySet`` -- a ``QuerySet`` that evaluates to a list of |
476 | 494 | ``datetime.datetime`` objects representing all available dates of a particular |
477 | 495 | kind within the contents of the ``QuerySet``. |
… |
… |
|
506 | 524 | ``none()`` |
507 | 525 | ~~~~~~~~~~ |
508 | 526 | |
| 527 | .. method:: none() |
| 528 | |
509 | 529 | .. versionadded:: 1.0 |
510 | 530 | |
511 | 531 | Returns an ``EmptyQuerySet`` -- a ``QuerySet`` that always evaluates to |
… |
… |
|
519 | 539 | [] |
520 | 540 | |
521 | 541 | ``all()`` |
522 | | ~~~~~~~~~~ |
| 542 | ~~~~~~~~~ |
| 543 | |
| 544 | .. method:: all() |
523 | 545 | |
524 | 546 | .. versionadded:: 1.0 |
525 | 547 | |
… |
… |
|
534 | 556 | ``select_related()`` |
535 | 557 | ~~~~~~~~~~~~~~~~~~~~ |
536 | 558 | |
| 559 | .. method:: select_related() |
| 560 | |
537 | 561 | Returns a ``QuerySet`` that will automatically "follow" foreign-key |
538 | 562 | relationships, selecting that additional related-object data when it executes |
539 | 563 | its query. This is a performance booster which results in (sometimes much) |
… |
… |
|
655 | 679 | ``extra(select=None, where=None, params=None, tables=None, order_by=None, select_params=None)`` |
656 | 680 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
657 | 681 | |
| 682 | .. method:: extra(select=None, where=None, params=None, tables=None, order_by=None, select_params=None) |
| 683 | |
658 | 684 | Sometimes, the Django query syntax by itself can't easily express a complex |
659 | 685 | ``WHERE`` clause. For these edge cases, Django provides the ``extra()`` |
660 | 686 | ``QuerySet`` modifier -- a hook for injecting specific clauses into the SQL |
… |
… |
|
817 | 843 | ``defer(*fields)`` |
818 | 844 | ~~~~~~~~~~~~~~~~~~ |
819 | 845 | |
| 846 | .. method:: defer(*fields) |
| 847 | |
820 | 848 | .. versionadded:: 1.1 |
821 | 849 | |
822 | 850 | In some complex data-modeling situations, your models might contain a lot of |
… |
… |
|
873 | 901 | settled down and you understand where the hot-points are. |
874 | 902 | |
875 | 903 | ``only(*fields)`` |
876 | | ~~~~~~~~~~~~~~~~~~ |
| 904 | ~~~~~~~~~~~~~~~~~ |
| 905 | |
| 906 | .. method:: only(*fields) |
877 | 907 | |
878 | 908 | .. versionadded:: 1.1 |
879 | 909 | |
… |
… |
|
909 | 939 | Entry.objects.defer("body").only("headline", "body") |
910 | 940 | |
911 | 941 | ``using(alias)`` |
912 | | ~~~~~~~~~~~~~~~~~~ |
| 942 | ~~~~~~~~~~~~~~~~ |
| 943 | |
| 944 | .. method:: using(alias) |
913 | 945 | |
914 | 946 | .. versionadded:: 1.2 |
915 | 947 | |
… |
… |
|
941 | 973 | ``get(**kwargs)`` |
942 | 974 | ~~~~~~~~~~~~~~~~~ |
943 | 975 | |
| 976 | .. method:: get(**kwargs) |
| 977 | |
944 | 978 | Returns the object matching the given lookup parameters, which should be in |
945 | 979 | the format described in `Field lookups`_. |
946 | 980 | |
… |
… |
|
968 | 1002 | ``create(**kwargs)`` |
969 | 1003 | ~~~~~~~~~~~~~~~~~~~~ |
970 | 1004 | |
| 1005 | .. method:: create(**kwargs) |
| 1006 | |
971 | 1007 | A convenience method for creating an object and saving it all in one step. Thus:: |
972 | 1008 | |
973 | 1009 | p = Person.objects.create(first_name="Bruce", last_name="Springsteen") |
… |
… |
|
990 | 1026 | ``get_or_create(**kwargs)`` |
991 | 1027 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
992 | 1028 | |
| 1029 | .. method:: get_or_create(**kwargs) |
| 1030 | |
993 | 1031 | A convenience method for looking up an object with the given kwargs, creating |
994 | 1032 | one if necessary. |
995 | 1033 | |
… |
… |
|
1058 | 1096 | ``count()`` |
1059 | 1097 | ~~~~~~~~~~~ |
1060 | 1098 | |
| 1099 | .. method:: count() |
| 1100 | |
1061 | 1101 | Returns an integer representing the number of objects in the database matching |
1062 | 1102 | the ``QuerySet``. ``count()`` never raises exceptions. |
1063 | 1103 | |
… |
… |
|
1082 | 1122 | ``in_bulk(id_list)`` |
1083 | 1123 | ~~~~~~~~~~~~~~~~~~~~ |
1084 | 1124 | |
| 1125 | .. method:: in_bulk(id_list) |
| 1126 | |
1085 | 1127 | Takes a list of primary-key values and returns a dictionary mapping each |
1086 | 1128 | primary-key value to an instance of the object with the given ID. |
1087 | 1129 | |
… |
… |
|
1101 | 1143 | ``iterator()`` |
1102 | 1144 | ~~~~~~~~~~~~~~ |
1103 | 1145 | |
| 1146 | .. method:: iterator() |
| 1147 | |
1104 | 1148 | Evaluates the ``QuerySet`` (by performing the query) and returns an |
1105 | 1149 | `iterator`_ over the results. A ``QuerySet`` typically caches its |
1106 | 1150 | results internally so that repeated evaluations do not result in |
… |
… |
|
1117 | 1161 | ``latest(field_name=None)`` |
1118 | 1162 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1119 | 1163 | |
| 1164 | .. method:: latest(field_name=None) |
| 1165 | |
1120 | 1166 | Returns the latest object in the table, by date, using the ``field_name`` |
1121 | 1167 | provided as the date field. |
1122 | 1168 | |
… |
… |
|
1137 | 1183 | ``aggregate(*args, **kwargs)`` |
1138 | 1184 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1139 | 1185 | |
| 1186 | .. method:: aggregate(*args, **kwargs) |
| 1187 | |
1140 | 1188 | .. versionadded:: 1.1 |
1141 | 1189 | |
1142 | 1190 | Returns a dictionary of aggregate values (averages, sums, etc) calculated |
… |
… |
|
1169 | 1217 | ``exists()`` |
1170 | 1218 | ~~~~~~~~~~~~ |
1171 | 1219 | |
| 1220 | .. method:: exists() |
| 1221 | |
1172 | 1222 | .. versionadded:: 1.2 |
1173 | 1223 | |
1174 | 1224 | Returns ``True`` if the :class:`QuerySet` contains any results, and ``False`` |