Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Edited some docs/db-api.txt changes

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6d986360183101c26c51adee4229bc038e63e441 1 parent 81edb50
Adrian Holovaty authored April 28, 2008

Showing 1 changed file with 13 additions and 13 deletions. Show diff stats Hide diff stats

  1. 26  docs/db-api.txt
26  docs/db-api.txt
@@ -527,7 +527,7 @@ applied to a query, not even the default ordering, call ``order_by()`` with no
527 527
 parameters.
528 528
 
529 529
 **New in Django development version:** The syntax for ordering across related
530  
-models has changed. See the `Django 0.96 documentation`_ for the old behaviour.
  530
+models has changed. See the `Django 0.96 documentation`_ for the old behavior.
531 531
 
532 532
 .. _Django 0.96 documentation: http://www.djangoproject.com/documentation/0.96/model-api/#floatfield
533 533
 
@@ -540,9 +540,9 @@ backend normally orders them.
540 540
 
541 541
 **New in Django development version**
542 542
 
543  
-If you want to reverse the order in which a queryset's elements are returned,
544  
-you can use the ``reverse()`` method. Calling ``reverse()`` a second time
545  
-restores the ordering back to the normal direction.
  543
+Use the ``reverse()`` method to reverse the order in which a queryset's
  544
+elements are returned. Calling ``reverse()`` a second time restores the
  545
+ordering back to the normal direction.
546 546
 
547 547
 To retrieve the ''last'' five items in a queryset, you could do this::
548 548
 
@@ -552,7 +552,7 @@ Note that this is not quite the same as slicing from the end of a sequence in
552 552
 Python. The above example will return the last item first, then the
553 553
 penultimate item and so on. If we had a Python sequence and looked at
554 554
 ``seq[:-5]``, we would see the fifth-last item first. Django doesn't support
555  
-that mode of access (slicing from the end), since it is not possible to do it
  555
+that mode of access (slicing from the end), because it's not possible to do it
556 556
 efficiently in SQL.
557 557
 
558 558
 ``distinct()``
@@ -1660,7 +1660,7 @@ entry. The entries select by the second filter may or may not be the same as
1660 1660
 the entries in the first filter. We are filtering the ``Blog`` items with each
1661 1661
 filter statement, not the ``Entry`` items.
1662 1662
 
1663  
-All of this behaviour also applies to ``exclude()``: all the conditions in a
  1663
+All of this behavior also applies to ``exclude()``: all the conditions in a
1664 1664
 single ``exclude()`` statement apply to a single instance (if those conditions
1665 1665
 are talking about the same multi-valued relation). Conditions in subsequent
1666 1666
 ``filter()`` or ``exclude()`` calls that refer to the same relation may end up
@@ -2101,24 +2101,24 @@ Updating multiple objects at once
2101 2101
 **New in Django development version**
2102 2102
 
2103 2103
 Sometimes you want to set a field to a particular value for all the objects in
2104  
-a queryset. You can do this with the ``update()`` method. For example::
  2104
+a ``QuerySet``. You can do this with the ``update()`` method. For example::
2105 2105
 
2106  
-    # Update all the headlines to the same value.
2107  
-    Entry.objects.all().update(headline='Everything is the same')
  2106
+    # Update all the headlines with pub_date in 2007.
  2107
+    Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
2108 2108
 
2109 2109
 You can only set non-relation fields and ``ForeignKey`` fields using this
2110  
-method and the value you set the field to must be a normal Python value (you
2111  
-can't set a field to be equal to some other field at the moment).
  2110
+method, and the value you set the field to must be a hard-coded Python value
  2111
+(i.e., you can't set a field to be equal to some other field at the moment).
2112 2112
 
2113 2113
 To update ``ForeignKey`` fields, set the new value to be the new model
2114 2114
 instance you want to point to. Example::
2115 2115
 
2116 2116
     b = Blog.objects.get(pk=1)
2117  
-    # Make all entries belong to this blog.
  2117
+    # Change every Entry so that it belongs to this Blog.
2118 2118
     Entry.objects.all().update(blog=b)
2119 2119
 
2120 2120
 The ``update()`` method is applied instantly and doesn't return anything
2121  
-(similar to ``delete()``). The only restriction on the queryset that is
  2121
+(similar to ``delete()``). The only restriction on the ``QuerySet`` that is
2122 2122
 updated is that it can only access one database table, the model's main
2123 2123
 table. So don't try to filter based on related fields or anything like that;
2124 2124
 it won't work.

0 notes on commit 6d98636

Please sign in to comment.
Something went wrong with that request. Please try again.