| 209 | .. admonition:: ``all()`` is lazy |
| 210 | |
| 211 | It might look a little frightening to see ``Poll.objects.all()`` |
| 212 | being used in a detail view which only needs one ``Poll`` object, |
| 213 | but don't worry; ``Poll.objects.all()`` is actually a special |
| 214 | object called a ``QuerySet``, which is "lazy" and doesn't hit your |
| 215 | database until it absolutely has to. By the time the database |
| 216 | query happens, the ``object_detail`` generic view will have |
| 217 | narrowed its scope down to a single object, so the eventual query |
| 218 | will only select one row from the database. If you'd like to know |
| 219 | more about how that works, The Django database API documentation |
| 220 | explains `the lazy nature of ``QuerySet`` objects`_. |
| 221 | |
| 222 | .. _the lazy nature of ``QuerySet`` objects: ../db_api/#querysets-are-lazy |
| 223 | |