Ticket #12620: 12620.patch

File 12620.patch, 1.8 KB (added by dwillis, 6 years ago)
  • docs/ref/models/querysets.txt

    From b7b7a4c13b6be2526c5b7c75b8fcc12e1524dec1 Mon Sep 17 00:00:00 2001
    From: Derek Willis <dwillis@gmail.com>
    Date: Fri, 12 Feb 2010 22:53:40 -0500
    Subject: [PATCH] removed references to lede
    
    ---
     docs/ref/models/querysets.txt |    6 +++---
     1 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
    index db2fa56..f0eceb1 100644
    a b the database. 
    820820
    821821This is done by passing the names of the fields to not load to ``defer()``::
    822822
    823     Entry.objects.defer("lede", "body")
     823    Entry.objects.defer("headline", "body")
    824824
    825825A queryset that has deferred fields will still return model instances. Each
    826826deferred field will be retrieved from the database if you access that field
    You can make multiple calls to ``defer()``. Each call adds new fields to the 
    830830deferred set::
    831831
    832832    # Defers both the body and lede fields.
    833     Entry.objects.defer("body").filter(headline="Lennon").defer("lede")
     833    Entry.objects.defer("body").filter(rating=5).defer("headline")
    834834
    835835The order in which fields are added to the deferred set does not matter. Calling ``defer()`` with a field name that has already been deferred is harmless (the field will still be deferred).
    836836
    You can defer loading of fields in related models (if the related models are 
    838838loading via ``select_related()``) by using the standard double-underscore
    839839notation to separate related fields::
    840840
    841     Blog.objects.select_related().defer("entry__lede", "entry__body")
     841    Blog.objects.select_related().defer("entry__headline", "entry__body")
    842842
    843843If you want to clear the set of deferred fields, pass ``None`` as a parameter
    844844to ``defer()``::
Back to Top