Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.1.X] Fixed #12997 -- Corrected the module markup for QuerySet meth…

…ods. Thanks to timo for the report.

Backport of r13235 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@13236 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6f2a84409e122b5a1d9ce96491b14ee05600f81a 1 parent 08de7a3
Russell Keith-Magee authored May 11, 2010
2  docs/ref/models/querysets.txt
@@ -4,7 +4,7 @@
4 4
 QuerySet API reference
5 5
 ======================
6 6
 
7  
-.. currentmodule:: django.db.models
  7
+.. currentmodule:: django.db.models.QuerySet
8 8
 
9 9
 This document describes the details of the ``QuerySet`` API. It builds on the
10 10
 material presented in the :ref:`model <topics-db-models>` and :ref:`database
38  docs/ref/models/relations.txt
@@ -4,33 +4,33 @@
4 4
 Related objects reference
5 5
 =========================
6 6
 
7  
-.. currentmodule:: django.db.models
  7
+.. currentmodule:: django.db.models.fields.related
8 8
 
9 9
 This document describes extra methods available on managers when used in a one-to-many or many-to-many related context. This happens in two cases:
10 10
 
11 11
     * The "other side" of a ``ForeignKey`` relation. That is::
12  
-    
  12
+
13 13
             class Reporter(models.Model):
14 14
                 ...
15  
-                
  15
+
16 16
             class Article(models.Model):
17 17
                 reporter = models.ForeignKey(Reporter)
18  
-            
  18
+
19 19
       In the above example, the methods below will be available on
20 20
       the manager ``reporter.article_set``.
21  
-      
  21
+
22 22
     * Both sides of a ``ManyToManyField`` relation::
23  
-    
  23
+
24 24
             class Topping(models.Model):
25 25
                 ...
26  
-                
  26
+
27 27
             class Pizza(models.Model):
28 28
                 toppings = models.ManyToManyField(Topping)
29  
-                
  29
+
30 30
       In this example, the methods below will be available both on
31 31
       ``topping.pizza_set`` and on ``pizza.toppings``.
32 32
 
33  
-.. method:: QuerySet.add(obj1, [obj2, ...])
  33
+.. method:: add(obj1, [obj2, ...])
34 34
 
35 35
     Adds the specified model objects to the related object set.
36 36
 
@@ -40,27 +40,27 @@ This document describes extra methods available on managers when used in a one-t
40 40
         >>> e = Entry.objects.get(id=234)
41 41
         >>> b.entry_set.add(e) # Associates Entry e with Blog b.
42 42
 
43  
-.. method:: QuerySet.create(**kwargs)
  43
+.. method:: create(**kwargs)
44 44
 
45 45
     Creates a new object, saves it and puts it in the related object set.
46 46
     Returns the newly created object::
47 47
 
48 48
         >>> b = Blog.objects.get(id=1)
49 49
         >>> e = b.entry_set.create(
50  
-        ...     headline='Hello', 
51  
-        ...     body_text='Hi', 
  50
+        ...     headline='Hello',
  51
+        ...     body_text='Hi',
52 52
         ...     pub_date=datetime.date(2005, 1, 1)
53 53
         ... )
54  
-        
  54
+
55 55
         # No need to call e.save() at this point -- it's already been saved.
56 56
 
57 57
     This is equivalent to (but much simpler than)::
58 58
 
59 59
         >>> b = Blog.objects.get(id=1)
60 60
         >>> e = Entry(
61  
-        ....     blog=b, 
62  
-        ....     headline='Hello', 
63  
-        ....     body_text='Hi', 
  61
+        ....     blog=b,
  62
+        ....     headline='Hello',
  63
+        ....     body_text='Hi',
64 64
         ....     pub_date=datetime.date(2005, 1, 1)
65 65
         .... )
66 66
         >>> e.save(force_insert=True)
@@ -70,10 +70,10 @@ This document describes extra methods available on managers when used in a one-t
70 70
     ``blog`` to ``create()``. Django figures out that the new ``Entry`` object's
71 71
     ``blog`` field should be set to ``b``.
72 72
 
73  
-.. method:: QuerySet.remove(obj1, [obj2, ...])
  73
+.. method:: remove(obj1, [obj2, ...])
74 74
 
75 75
     Removes the specified model objects from the related object set::
76  
-    
  76
+
77 77
         >>> b = Blog.objects.get(id=1)
78 78
         >>> e = Entry.objects.get(id=234)
79 79
         >>> b.entry_set.remove(e) # Disassociates Entry e from Blog b.
@@ -85,7 +85,7 @@ This document describes extra methods available on managers when used in a one-t
85 85
     ``b.entry_set()`` is equivalent to doing ``e.blog = None``, and because the
86 86
     ``blog`` ``ForeignKey`` doesn't have ``null=True``, this is invalid.
87 87
 
88  
-.. method:: QuerySet.clear()
  88
+.. method:: clear()
89 89
 
90 90
     Removes all objects from the related object set::
91 91
 

0 notes on commit 6f2a844

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