Django

Code

Changeset 2741

Show
Ignore:
Timestamp:
04/23/06 18:22:42 (3 years ago)
Author:
adrian
Message:

magic-removal: Fixed section titles in docs/db-api.txt to uncapitalize words, to match our style

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/docs/db-api.txt

    r2706 r2741  
    1616        pub_date = models.DateTimeField() 
    1717        expire_date = models.DateTimeField() 
    18          
     18 
    1919        def __repr__(self): 
    2020            return self.question 
     
    4444    [What's up?, What's your name?] 
    4545 
    46 How Queries Work 
     46How queries work 
    4747================ 
    4848 
    49 Querying in Django is based upon the construction and evaluation of Query  
    50 Sets.  
    51  
    52 A Query Set is a database-independent representation of a group of objects  
    53 that all meet a given set of criteria. However, the determination of which  
     49Querying in Django is based upon the construction and evaluation of Query 
     50Sets. 
     51 
     52A Query Set is a database-independent representation of a group of objects 
     53that all meet a given set of criteria. However, the determination of which 
    5454objects are actually members of the Query Set is not made until you formally 
    5555evaluate the Query Set. 
    5656 
    5757To construct a Query Set that meets your requirements, you start by obtaining 
    58 an initial Query Set that describes all objects of a given type. This initial  
    59 Query Set can then be refined using a range of operations. Once you have  
    60 refined your Query Set to the point where it describes the group of objects  
    61 you require, it can be evaluated (using iterators, slicing, or one of a range  
    62 of other techniques), yielding an object or list of objects that meet the  
     58an initial Query Set that describes all objects of a given type. This initial 
     59Query Set can then be refined using a range of operations. Once you have 
     60refined your Query Set to the point where it describes the group of objects 
     61you require, it can be evaluated (using iterators, slicing, or one of a range 
     62of other techniques), yielding an object or list of objects that meet the 
    6363specifications of the Query Set. 
    6464 
    65 Obtaining an Initial Query Set 
    66 ============================== 
    67  
    68 Every model has at least one Manager; by default, the Manager is called  
    69 ``objects``. One of the most important roles of the Manager is as a source  
    70 of initial Query Sets. The Manager acts as a Query Set that describes all  
    71 objects of the type being managed; ``Polls.objects`` is the initial Query Set  
     65Obtaining an initial QuerySet 
     66============================= 
     67 
     68Every model has at least one Manager; by default, the Manager is called 
     69``objects``. One of the most important roles of the Manager is as a source 
     70of initial Query Sets. The Manager acts as a Query Set that describes all 
     71objects of the type being managed; ``Polls.objects`` is the initial Query Set 
    7272that contains all Polls in the database. 
    7373 
    74 The initial Query Set on the Manager behaves in the same way as every other  
    75 Query Set in every respect except one - it cannot be evaluated. To overcome  
     74The initial Query Set on the Manager behaves in the same way as every other 
     75Query Set in every respect except one - it cannot be evaluated. To overcome 
    7676this limitation, the Manager Query Set has an ``all()`` method. The ``all()`` 
    77 method produces a copy of the initial Query Set - a copy that *can* be  
     77method produces a copy of the initial Query Set - a copy that *can* be 
    7878evaluated:: 
    7979 
    8080    all_polls = Poll.objects.all() 
    8181 
    82 See the `Managers`_ section of the Model API for more details on the role  
     82See the `Managers`_ section of the Model API for more details on the role 
    8383and construction of Managers. 
    8484 
    8585.. _Managers: http://www.djangoproject.com/documentation/model_api/#managers 
    8686 
    87 Query Set Refinement 
    88 ==================== 
    89  
    90 The initial Query Set provided by the Manager describes all objects of a  
    91 given type. However, you will usually need to describe a subset of the  
    92 complete set of objects.  
     87QuerySet refinement 
     88=================== 
     89 
     90The initial Query Set provided by the Manager describes all objects of a 
     91given type. However, you will usually need to describe a subset of the 
     92complete set of objects. 
    9393 
    9494To create such a subset, you refine the initial Query Set, adding conditions 
    95 until you have described a set that meets your needs. The two most common  
     95until you have described a set that meets your needs. The two most common 
    9696mechanisms for refining a Query Set are: 
    9797 
    9898``filter(**kwargs)`` 
    99     Returns a new Query Set containing objects that match the given lookup parameters.  
     99    Returns a new Query Set containing objects that match the given lookup parameters. 
    100100 
    101101``exclude(**kwargs)`` 
    102102    Return a new Query Set containing objects that do not match the given lookup parameters. 
    103103 
    104 Lookup parameters should be in the format described in "Field lookups" below.  
     104Lookup parameters should be in the format described in "Field lookups" below. 
    105105 
    106106The result of refining a Query Set is itself a Query Set; so it is possible to 
     
    112112                pub_date__gte=datetime(2005,1,1)) 
    113113 
    114 ...takes the initial Query Set, and adds a filter, then an exclusion, then  
    115 another filter to remove elements present in the initial Query Set. The  
    116 final result is a Query Set containing all Polls with a question that  
     114...takes the initial Query Set, and adds a filter, then an exclusion, then 
     115another filter to remove elements present in the initial Query Set. The 
     116final result is a Query Set containing all Polls with a question that 
    117117starts with "What", that were published between 1 Jan 2005 and today. 
    118118 
    119119Each Query Set is a unique object. The process of refinement is not one 
    120 of adding a condition to the initial Query Set. Rather, each refinement  
    121 creates a separate and distinct Query Set that can be stored, used. and  
     120of adding a condition to the initial Query Set. Rather, each refinement 
     121creates a separate and distinct Query Set that can be stored, used. and 
    122122reused. For example:: 
    123123 
     
    126126    q3 = q1.filter(pub_date__gte=datetime.now()) 
    127127 
    128 will construct 3 Query Sets; a base query set containing all Polls with a  
     128will construct 3 Query Sets; a base query set containing all Polls with a 
    129129question that starts with "What", and two subsets of the base Query Set (one 
    130 with an exlusion, one with a filter). The initial Query Set is unaffected by  
     130with an exlusion, one with a filter). The initial Query Set is unaffected by 
    131131the refinement process. 
    132132 
    133133It should be noted that the construction of a Query Set does not involve any 
    134 activity on the database. The database is not consulted until a Query Set is  
     134activity on the database. The database is not consulted until a Query Set is 
    135135evaluated. 
    136136 
     
    201201    Poll.objects.get(id__exact=14) 
    202202 
    203 Multiple lookup parameters are allowed. When separated by commans, the list of  
     203Multiple lookup parameters are allowed. When separated by commans, the list of 
    204204lookup parameters will be "AND"ed together:: 
    205205 
     
    210210    ) 
    211211 
    212 ...retrieves all polls published in January 2005 that have a question starting  
     212...retrieves all polls published in January 2005 that have a question starting 
    213213with "Would." 
    214214 
     
    233233========== 
    234234 
    235 Keyword argument queries are "AND"ed together. If you have more  
    236 complex query requirements (for example, you need to include an ``OR``  
     235Keyword argument queries are "AND"ed together. If you have more 
     236complex query requirements (for example, you need to include an ``OR`` 
    237237statement in your query), you need to use ``Q`` objects. 
    238238 
    239 A ``Q`` object (``django.db.models.Q``) is an object used to encapsulate a  
    240 collection of keyword arguments. These keyword arguments are specified in  
    241 the same way as keyword arguments to the basic lookup functions like get()  
     239A ``Q`` object (``django.db.models.Q``) is an object used to encapsulate a 
     240collection of keyword arguments. These keyword arguments are specified in 
     241the same way as keyword arguments to the basic lookup functions like get() 
    242242and filter(). For example:: 
    243243 
    244244    Q(question__startswith='What') 
    245245 
    246 is a ``Q`` object encapsulating a single ``LIKE`` query. ``Q`` objects can be  
    247 combined using the ``&`` and ``|`` operators. When an operator is used on two  
     246is a ``Q`` object encapsulating a single ``LIKE`` query. ``Q`` objects can be 
     247combined using the ``&`` and ``|`` operators. When an operator is used on two 
    248248``Q`` objects, it yields a new ``Q`` object. For example the statement:: 
    249249 
    250250    Q(question__startswith='Who') | Q(question__startswith='What') 
    251251 
    252 ... yields a single ``Q`` object that represents the "OR" of two  
     252... yields a single ``Q`` object that represents the "OR" of two 
    253253"question__startswith" queries, equivalent to the SQL WHERE clause:: 
    254254 
    255255    ... WHERE question LIKE 'Who%' OR question LIKE 'What%' 
    256256 
    257 You can compose statements of arbitrary complexity by combining ``Q`` objects  
     257You can compose statements of arbitrary complexity by combining ``Q`` objects 
    258258with the ``&`` and ``|`` operators. Parenthetical grouping can also be used. 
    259259 
    260 One or more ``Q`` objects can then provided as arguments to the lookup  
    261 functions. If multiple ``Q`` object arguments are provided to a lookup  
     260One or more ``Q`` objects can then provided as arguments to the lookup 
     261functions. If multiple ``Q`` object arguments are provided to a lookup 
    262262function, they will be "AND"ed together. For example:: 
    263263 
     
    272272        AND (pub_date = '2005-05-02' OR pub_date = '2005-05-06') 
    273273 
    274 If necessary, lookup functions can mix the use of ``Q`` objects and keyword  
    275 arguments. All arguments provided to a lookup function (be they keyword  
    276 argument or ``Q`` object) are "AND"ed together. However, if a ``Q`` object is  
    277 provided, it must precede the definition of any keyword arguments. For  
     274If necessary, lookup functions can mix the use of ``Q`` objects and keyword 
     275arguments. All arguments provided to a lookup function (be they keyword 
     276argument or ``Q`` object) are "AND"ed together. However, if a ``Q`` object is 
     277provided, it must precede the definition of any keyword arguments. For 
    278278example:: 
    279279 
     
    304304.. _OR lookups examples page: http://www.djangoproject.com/documentation/models/or_lookups/ 
    305305 
    306 Query Set evaluation 
    307 ==================== 
    308  
    309 A Query Set must be evaluated to return the objects that are contained in the  
     306QuerySet evaluation 
     307=================== 
     308 
     309A Query Set must be evaluated to return the objects that are contained in the 
    310310set. This can be achieved by iteration, slicing, or by specialist function. 
    311311 
     
    315315    for p in Poll.objects.all(): 
    316316        print p 
    317          
     317 
    318318will print all the Poll objects, using the ``__repr__()`` method of Poll. 
    319          
     319 
    320320A Query Set can also be sliced, using array notation:: 
    321321 
     
    324324    every_second_poll = Poll.objects.all()[::2] 
    325325 
    326 Query Sets are lazy objects - that is, they are not *actually* sets (or  
     326Query Sets are lazy objects - that is, they are not *actually* sets (or 
    327327lists) that contain all the objects that they represent. Python protocol 
    328328magic is used to make the Query Set *look* like an iterable, sliceable 
     
    338338create an in-memory representation of every element of the list. 
    339339 
    340 Caching and Query Sets 
    341 ====================== 
    342  
    343 Each Query Set contains a cache. In a newly created Query Set, this cache  
    344 is unpopulated. When a Query Set is evaluated for the first time, Django  
    345 makes a database query to populate the cache, and then returns the results  
    346 that have been explicitly requested (e.g., the next element if iteration  
     340Caching and QuerySets 
     341===================== 
     342 
     343Each Query Set contains a cache. In a newly created Query Set, this cache 
     344is unpopulated. When a Query Set is evaluated for the first time, Django 
     345makes a database query to populate the cache, and then returns the results 
     346that have been explicitly requested (e.g., the next element if iteration 
    347347is in use). Subsequent evaluations of the Query Set reuse the cached results. 
    348348 
    349 This caching behavior must be kept in mind when using Query Sets. For  
     349This caching behavior must be kept in mind when using Query Sets. For 
    350350example, the following will cause two temporary Query Sets to be created, 
    351351evaluated, and thrown away:: 
     
    355355 
    356356On a small, low-traffic website, this may not pose a serious problem. However, 
    357 on a high traffic website, it effectively doubles your database load. In  
    358 addition, there is a possibility that the two lists may not be identical,  
    359 since a poll may be added or deleted by another user between making the two  
    360 requests.  
     357on a high traffic website, it effectively doubles your database load. In 
     358addition, there is a possibility that the two lists may not be identical, 
     359since a poll may be added or deleted by another user between making the two 
     360requests. 
    361361 
    362362To avoid this problem, simply save the Query Set and reuse it:: 
     
    366366    print [p for p in queryset] # Re-use the cache from the evaluation 
    367367 
    368 Specialist Query Set Evaluation 
    369 =============================== 
    370  
    371 The following specialist functions can also be used to evaluate a Query Set.  
    372 Unlike iteration or slicing, these methods do not populate the cache; each  
    373 time one of these evaluation functions is used, the database will be queried.  
     368Specialist QuerySet evaluation 
     369============================== 
     370 
     371The following specialist functions can also be used to evaluate a Query Set. 
     372Unlike iteration or slicing, these methods do not populate the cache; each 
     373time one of these evaluation functions is used, the database will be queried. 
    374374 
    375375``get(**kwargs)`` 
     
    410410 
    411411    >>> Poll.objects.latest() 
    412     What's up?     
     412    What's up? 
    413413    >>> Poll.objects.latest('expire_date') 
    414414    What's your name? 
     
    417417===================== 
    418418 
    419 When you define a relationship in a model (i.e., a ForeignKey,  
     419When you define a relationship in a model (i.e., a ForeignKey, 
    420420OneToOneField, or ManyToManyField), Django uses the name of the 
    421421relationship to add a descriptor_ on every instance of the model. 
    422422This descriptor behaves just like a normal attribute, providing 
    423 access to the related object or objects.  For example,  
    424 ``mychoice.poll`` will return the poll object associated with a specific  
     423access to the related object or objects.  For example, 
     424``mychoice.poll`` will return the poll object associated with a specific 
    425425instance of ``Choice``. 
    426426 
     
    429429Django also adds a descriptor for the 'other' side of the relationship - 
    430430the link from the related model to the model that defines the relationship. 
    431 Since the related model has no explicit reference to the source model,  
    432 Django will automatically derive a name for this descriptor. The name that  
    433 Django chooses depends on the type of relation that is represented. However,  
     431Since the related model has no explicit reference to the source model, 
     432Django will automatically derive a name for this descriptor. The name that 
     433Django chooses depends on the type of relation that is represented. However, 
    434434if the definition of the relation has a `related_name` parameter, Django 
    435435will use this name in preference to deriving a name. 
    436436 
    437 There are two types of descriptor that can be employed: Single Object  
    438 Descriptors and Object Set Descriptors. The following table describes  
    439 when each descriptor type is employed. The local model is the model on  
    440 which the relation is defined; the related model is the model referred  
     437There are two types of descriptor that can be employed: Single Object 
     438Descriptors and Object Set Descriptors. The following table describes 
     439when each descriptor type is employed. The local model is the model on 
     440which the relation is defined; the related model is the model referred 
    441441to by the relation. 
    442442 
     
    445445    =============== ============= ============= 
    446446    OneToOneField   Single Object Single Object 
    447      
     447 
    448448    ForeignKey      Single Object Object Set 
    449          
     449 
    450450    ManyToManyField Object Set    Object Set 
    451451    =============== ============= ============= 
    452452 
    453 Single Object Descriptor 
     453Single object descriptor 
    454454------------------------ 
    455455 
     
    464464    mychoice.save() 
    465465 
    466 Whenever a change is made to a Single Object Descriptor, save()  
     466Whenever a change is made to a Single Object Descriptor, save() 
    467467must be called to commit the change to the database. 
    468468 
    469 If no `related_name` parameter is defined, Django will use the  
     469If no `related_name` parameter is defined, Django will use the 
    470470lower case version of the source model name as the name for the 
    471 related descriptor. For example, if the ``Choice`` model had  
     471related descriptor. For example, if the ``Choice`` model had 
    472472a field:: 
    473      
     473 
    474474    coordinator = models.OneToOneField(User) 
    475      
     475 
    476476... instances of the model ``User`` would be able to call: 
    477477 
     
    481481By default, relations do not allow values of None; if you attempt 
    482482to assign None to a Single Object Descriptor, an AttributeError 
    483 will be thrown. However, if the relation has 'null=True' set  
    484 (i.e., the database will allow NULLs for the relation), None can  
     483will be thrown. However, if the relation has 'null=True' set 
     484(i.e., the database will allow NULLs for the relation), None can 
    485485be assigned and returned by the descriptor to represent empty 
    486486relations. 
     
    488488Access to Single Object Descriptors is cached. The first time 
    489489a descriptor on an instance is accessed, the database will be 
    490 queried, and the result stored. Subsequent attempts to access  
     490queried, and the result stored. Subsequent attempts to access 
    491491the descriptor on the same instance will use the cached value. 
    492492 
    493 Object Set Descriptor 
     493Object set descriptor 
    494494--------------------- 
    495495 
    496 An Object Set Descriptor acts just like the Manager - as an initial Query  
     496An Object Set Descriptor acts just like the Manager - as an initial Query 
    497497Set describing the set of objects related to an instance. As such, any 
    498 query refining technique (filter, exclude, etc) can be used on the Object  
     498query refining technique (filter, exclude, etc) can be used on the Object 
    499499Set descriptor. This also means that Object Set Descriptor cannot be evaluated 
    500500directly - the ``all()`` method must be used to produce a Query Set that 
    501501can be evaluated. 
    502502 
    503 If no ``related_name`` parameter is defined, Django will use the lower case  
    504 version of the source model name appended with `_set` as the name for the  
    505 related descriptor. For example, every ``Poll`` object has a ``choice_set``  
     503If no ``related_name`` parameter is defined, Django will use the lower case 
     504version of the source model name appended with `_set` as the name for the 
     505related descriptor. For example, every ``Poll`` object has a ``choice_set`` 
    506506descriptor. 
    507507 
    508 The Object Set Descriptor has utility methods to add objects to the  
     508The Object Set Descriptor has utility methods to add objects to the 
    509509related object set: 
    510510 
    511511``add(obj1, obj2, ...)`` 
    512     Add the specified objects to the related object set.  
    513      
     512    Add the specified objects to the related object set. 
     513 
    514514``create(\**kwargs)`` 
    515     Create a new object, and put it in the related object set. See  
     515    Create a new object, and put it in the related object set. See 
    516516    _`Creating new objects` 
    517517 
     
    520520 
    521521``remove(obj1, obj2, ...)`` 
    522     Remove the specified objects from the related object set.  
    523      
     522    Remove the specified objects from the related object set. 
     523 
    524524``clear()`` 
    525525    Remove all objects from the related object set. 
    526      
    527 These two removal methods will not exist on ForeignKeys where ``Null=False``  
     526 
     527These two removal methods will not exist on ForeignKeys where ``Null=False`` 
    528528(such as in the Poll example). This is to prevent database inconsistency - if 
    529529the related field cannot be set to None, then an object cannot be removed 
    530 from one relation without adding it to another.   
     530from one relation without adding it to another. 
    531531 
    532532The members of a related object set can be assigned from any iterable object. 
     
    536536 
    537537If the ``clear()`` method is available, any pre-existing objects will be removed 
    538 from the Object Set before all objects in the iterable (in this case, a list)  
    539 are added to the choice set. If the ``clear()`` method is not available, all  
    540 objects in the iterable will be added without removing any existing elements.  
     538from the Object Set before all objects in the iterable (in this case, a list) 
     539are added to the choice set. If the ``clear()`` method is not available, all 
     540objects in the iterable will be added without removing any existing elements. 
    541541 
    542542Each of these operations on the Object Set Descriptor has immediate effect 
    543543on the database - every add, create and remove is immediately and 
    544 automatically saved to the database.  
    545  
    546 Relationships and Queries 
     544automatically saved to the database. 
     545 
     546Relationships and queries 
    547547========================= 
    548548 
    549549When composing a ``filter`` or ``exclude`` refinement, it may be necessary to 
    550 include conditions that span relationships. Relations can be followed as deep  
    551 as required - just add descriptor names, separated by double underscores, to  
     550include conditions that span relationships. Relations can be followed as deep 
     551as required - just add descriptor names, separated by double underscores, to 
    552552describe the full path to the query attribute. The query:: 
    553553 
     
    555555 
    556556... is interpreted as 'get every Foo that has a name1 that has a name2 that 
    557 has a name3 that has an attribute with lookup matching value'. In the Poll  
     557has a name3 that has an attribute with lookup matching value'. In the Poll 
    558558example:: 
    559559 
    560560    Choice.objects.filter(poll__slug__startswith="eggs") 
    561561 
    562 ... describes the set of choices for which the related poll has a slug  
    563 attribute that starts with "eggs". Django automatically composes the joins  
     562... describes the set of choices for which the related poll has a slug 
     563attribute that starts with "eggs". Django automatically composes the joins 
    564564and conditions required for the SQL query. 
    565565 
    566 Specialist Query Sets Refinement  
    567 ================================ 
    568  
    569 In addition to ``filter`` and ``exclude()``, Django provides a range of  
    570 Query Set refinement methods that modify the types of results returned by  
     566Specialist QuerySets refinement 
     567=============================== 
     568 
     569In addition to ``filter`` and ``exclude()``, Django provides a range of 
     570Query Set refinement methods that modify the types of results returned by 
    571571the Query Set, or modify the way the SQL query is executed on the database. 
    572572 
     
    574574---------------------- 
    575575 
    576 The results returned by a Query Set are automatically ordered by the ordering  
    577 tuple given by the ``ordering`` meta key in the model. However, ordering may be  
     576The results returned by a Query Set are automatically ordered by the ordering 
     577tuple given by the ``ordering`` meta key in the model. However, ordering may be 
    578578explicitly provided by using the ``order_by`` method:: 
    579579 
    580     Poll.objects.filter(pub_date__year=2005,  
     580    Poll.objects.filter(pub_date__year=2005, 
    581581        pub_date__month=1).order_by('-pub_date', 'question') 
    582582 
     
    600600-------------- 
    601601 
    602 By default, a Query Set will not eliminate duplicate rows. This will not  
     602By default, a Query Set will not eliminate duplicate rows. This will not 
    603603happen during simple queries; however, if your query spans relations, 
    604604or you are using a Values Query Set with a ``fields`` clause, it is possible 
    605 to get duplicated results when a Query Set is evaluated.  
     605to get duplicated results when a Query Set is evaluated. 
    606606 
    607607``distinct()`` returns a new Query Set that eliminates duplicate rows from the 
    608 results returned by the Query Set. This is equivalent to a ``SELECT DISTINCT``  
    609 SQL clause.  
     608results returned by the Query Set. This is equivalent to a ``SELECT DISTINCT`` 
     609SQL clause. 
    610610 
    611611``values(*fields)`` 
    612612-------------------- 
    613613 
    614 Returns a Values Query Set - a Query Set that evaluates to a list of  
    615 dictionaries instead of model-instance objects. Each dictionary in the  
    616 list will represent an object matching the query, with the keys matching  
     614Returns a Values Query Set - a Query Set that evaluates to a list of 
     615dictionaries instead of model-instance objects. Each dictionary in the 
     616list will represent an object matching the query, with the keys matching 
    617617the attribute names of the object. 
    618618 
     
    624624 
    625625    >>> Poll.objects.values() 
    626     [{'id': 1, 'slug': 'whatsup', 'question': "What's up?",  
    627             'pub_date': datetime.datetime(2005, 2, 20),  
     626    [{'id': 1, 'slug': 'whatsup', 'question': "What's up?", 
     627            'pub_date': datetime.datetime(2005, 2, 20), 
    628628            'expire_date': datetime.datetime(2005, 3, 20)}, 
    629      {'id': 2, 'slug': 'name', 'question': "What's your name?",  
    630             'pub_date': datetime.datetime(2005, 3, 20),  
     629     {'id': 2, 'slug': 'name', 'question': "What's your name?", 
     630            'pub_date': datetime.datetime(2005, 3, 20), 
    631631            'expire_date': datetime.datetime(2005, 4, 20)}] 
    632632    >>> Poll.objects.values('id', 'slug') 
     
    634634 
    635635A Values Query Set is useful when you know you're only going to need values 
    636 from a small number of the available fields and you won't need the  
    637 functionality of a model instance object. It's more efficient to select only  
     636from a small number of the available fields and you won't need the 
     637functionality of a model instance object. It's more efficient to select only 
    638638the fields you need to use. 
    639639 
     
    641641----------------------------------- 
    642642 
    643 Returns a Date Query Set - a Query Set that evaluates to a list of  
    644 ``datetime.datetime`` objects representing all available dates of a  
     643Returns a Date Query Set - a Query Set that evaluates to a list of 
     644``datetime.datetime`` objects representing all available dates of a 
    645645particular kind within the contents of the Query Set. 
    646646 
     
    720720for injecting specific clauses into the SQL generated by a Query Set. 
    721721 
    722 Note that by definition these extra lookups may not be portable to different  
    723 database engines (because you're explicitly writing SQL code) and should be  
     722Note that by definition these extra lookups may not be portable to different 
     723database engines (because you're explicitly writing SQL code) and should be 
    724724avoided if possible.: 
    725725 
     
    828828 
    829829This is a safety mechanism to prevent you from accidentally requesting 
    830 ``Polls.objects.delete()``, and deleting *all* the polls.  
     830``Polls.objects.delete()``, and deleting *all* the polls. 
    831831 
    832832If you *actually* want to delete all the objects, then you have to explicitly 
     
    857857====================== 
    858858 
    859 In addition to ``save()``, ``delete()``, a model object might get any or all  
     859In addition to ``save()``, ``delete()``, a model object might get any or all 
    860860of the following methods: 
    861861 
     
    943943``get_FOO_width()`` methods, where ``FOO`` is the name of the field. This 
    944944returns the height (or width) of the image, as an integer, in pixels. 
    945