Skip to content

Commit 6f2a844

Browse files
committed
[1.1.X] Fixed #12997 -- Corrected the module markup for QuerySet methods. 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
1 parent 08de7a3 commit 6f2a844

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

docs/ref/models/querysets.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
QuerySet API reference
55
======================
66

7-
.. currentmodule:: django.db.models
7+
.. currentmodule:: django.db.models.QuerySet
88

99
This document describes the details of the ``QuerySet`` API. It builds on the
1010
material presented in the :ref:`model <topics-db-models>` and :ref:`database

docs/ref/models/relations.txt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,33 @@
44
Related objects reference
55
=========================
66

7-
.. currentmodule:: django.db.models
7+
.. currentmodule:: django.db.models.fields.related
88

99
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:
1010

1111
* The "other side" of a ``ForeignKey`` relation. That is::
12-
12+
1313
class Reporter(models.Model):
1414
...
15-
15+
1616
class Article(models.Model):
1717
reporter = models.ForeignKey(Reporter)
18-
18+
1919
In the above example, the methods below will be available on
2020
the manager ``reporter.article_set``.
21-
21+
2222
* Both sides of a ``ManyToManyField`` relation::
23-
23+
2424
class Topping(models.Model):
2525
...
26-
26+
2727
class Pizza(models.Model):
2828
toppings = models.ManyToManyField(Topping)
29-
29+
3030
In this example, the methods below will be available both on
3131
``topping.pizza_set`` and on ``pizza.toppings``.
3232

33-
.. method:: QuerySet.add(obj1, [obj2, ...])
33+
.. method:: add(obj1, [obj2, ...])
3434

3535
Adds the specified model objects to the related object set.
3636

@@ -40,27 +40,27 @@ This document describes extra methods available on managers when used in a one-t
4040
>>> e = Entry.objects.get(id=234)
4141
>>> b.entry_set.add(e) # Associates Entry e with Blog b.
4242

43-
.. method:: QuerySet.create(**kwargs)
43+
.. method:: create(**kwargs)
4444

4545
Creates a new object, saves it and puts it in the related object set.
4646
Returns the newly created object::
4747

4848
>>> b = Blog.objects.get(id=1)
4949
>>> e = b.entry_set.create(
50-
... headline='Hello',
51-
... body_text='Hi',
50+
... headline='Hello',
51+
... body_text='Hi',
5252
... pub_date=datetime.date(2005, 1, 1)
5353
... )
54-
54+
5555
# No need to call e.save() at this point -- it's already been saved.
5656

5757
This is equivalent to (but much simpler than)::
5858

5959
>>> b = Blog.objects.get(id=1)
6060
>>> e = Entry(
61-
.... blog=b,
62-
.... headline='Hello',
63-
.... body_text='Hi',
61+
.... blog=b,
62+
.... headline='Hello',
63+
.... body_text='Hi',
6464
.... pub_date=datetime.date(2005, 1, 1)
6565
.... )
6666
>>> e.save(force_insert=True)
@@ -70,10 +70,10 @@ This document describes extra methods available on managers when used in a one-t
7070
``blog`` to ``create()``. Django figures out that the new ``Entry`` object's
7171
``blog`` field should be set to ``b``.
7272

73-
.. method:: QuerySet.remove(obj1, [obj2, ...])
73+
.. method:: remove(obj1, [obj2, ...])
7474

7575
Removes the specified model objects from the related object set::
76-
76+
7777
>>> b = Blog.objects.get(id=1)
7878
>>> e = Entry.objects.get(id=234)
7979
>>> 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
8585
``b.entry_set()`` is equivalent to doing ``e.blog = None``, and because the
8686
``blog`` ``ForeignKey`` doesn't have ``null=True``, this is invalid.
8787

88-
.. method:: QuerySet.clear()
88+
.. method:: clear()
8989

9090
Removes all objects from the related object set::
9191

0 commit comments

Comments
 (0)