Merge pull request #1567 from technivore/ticket_20970

re-indented method documentation within RelatedManager
This commit is contained in:
Tim Graham 2013-09-06 12:07:25 -07:00
commit 38d2e7c225
1 changed files with 70 additions and 75 deletions

View File

@ -36,12 +36,7 @@ Related objects reference
In this example, the methods below will be available both on In this example, the methods below will be available both on
``topping.pizza_set`` and on ``pizza.toppings``. ``topping.pizza_set`` and on ``pizza.toppings``.
.. _related-manager-methods: .. method:: add(obj1, [obj2, ...])
Related Manager Methods
-----------------------
.. method:: add(obj1, [obj2, ...])
Adds the specified model objects to the related object set. Adds the specified model objects to the related object set.
@ -61,7 +56,7 @@ Related Manager Methods
some custom logic when a relationship is created, listen to the some custom logic when a relationship is created, listen to the
:data:`~django.db.models.signals.m2m_changed` signal. :data:`~django.db.models.signals.m2m_changed` signal.
.. method:: create(**kwargs) .. method:: create(**kwargs)
Creates a new object, saves it and puts it in the related object set. Creates a new object, saves it and puts it in the related object set.
Returns the newly created object:: Returns the newly created object::
@ -91,7 +86,7 @@ Related Manager Methods
parameter ``blog`` to ``create()``. Django figures out that the new parameter ``blog`` to ``create()``. Django figures out that the new
``Entry`` object's ``blog`` field should be set to ``b``. ``Entry`` object's ``blog`` field should be set to ``b``.
.. method:: remove(obj1, [obj2, ...]) .. method:: remove(obj1, [obj2, ...])
Removes the specified model objects from the related object set:: Removes the specified model objects from the related object set::
@ -115,7 +110,7 @@ Related Manager Methods
the ``blog`` :class:`~django.db.models.ForeignKey` doesn't have the ``blog`` :class:`~django.db.models.ForeignKey` doesn't have
``null=True``, this is invalid. ``null=True``, this is invalid.
.. method:: clear() .. method:: clear()
Removes all objects from the related object set:: Removes all objects from the related object set::
@ -128,7 +123,7 @@ Related Manager Methods
Just like ``remove()``, ``clear()`` is only available on Just like ``remove()``, ``clear()`` is only available on
:class:`~django.db.models.ForeignKey`\s where ``null=True``. :class:`~django.db.models.ForeignKey`\s where ``null=True``.
.. note:: .. note::
Note that ``add()``, ``create()``, ``remove()``, and ``clear()`` all Note that ``add()``, ``create()``, ``remove()``, and ``clear()`` all
apply database changes immediately for all types of related fields. In other apply database changes immediately for all types of related fields. In other