Ticket #10139: queryset_slice_return_type.diff

File queryset_slice_return_type.diff, 1.0 KB (added by ori, 4 years ago)

document which type will be returned when slicing a QuerySet

  • docs/ref/models/querysets.txt

     
    3232          print e.headline
    3333
    3434* **Slicing.** As explained in :ref:`limiting-querysets`, a ``QuerySet`` can
    35   be sliced, using Python's array-slicing syntax. Usually slicing a
    36   ``QuerySet`` returns another (unevaluated) ``QuerySet``, but Django will
    37   execute the database query if you use the "step" parameter of slice
    38   syntax.
     35  be sliced, using Python's array-slicing syntax. Slicing an unevaluated
     36  ``QuerySet`` usually returns another (unevaluated) ``QuerySet``, but Django
     37  will execute the database query if you use the "step" parameter of slice
     38  syntax, and will return a list. Slicing a a ``QuerySet`` that has been
     39  evaluated (whether partially or fully) also returns a list.
    3940
    4041* **Pickling/Caching.** See the following section for details of what
    4142  is involved when `pickling QuerySets`_. The important thing for the
Back to Top