mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed a whole bunch of small docs typos, errors, and ommissions.
Fixes #8358, #8396, #8724, #9043, #9128, #9247, #9267, #9267, #9375, #9409, #9414, #9416, #9446, #9454, #9464, #9503, #9518, #9533, #9657, #9658, #9683, #9733, #9771, #9835, #9836, #9837, #9897, #9906, #9912, #9945, #9986, #9992, #10055, #10084, #10091, #10145, #10245, #10257, #10309, #10358, #10359, #10424, #10426, #10508, #10531, #10551, #10635, #10637, #10656, #10658, #10690, #10699, #19528. Thanks to all the respective authors of those tickets. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10371 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -870,11 +870,11 @@ the model is related. This works exactly the same as it does for
|
||||
Behind the scenes, Django creates an intermediary join table to represent the
|
||||
many-to-many relationship. By default, this table name is generated using the
|
||||
names of the two tables being joined. Since some databases don't support table
|
||||
names above a certain length (often 32 characters), these table names will be
|
||||
automatically truncated to 32 characters and a uniqueness hash will be used.
|
||||
This means you might see table names like ``author_books_9cdf4``; this is
|
||||
perfectly normal. You can manually provide the name of the join table using
|
||||
the :attr:`~ManyToManyField.db_table` option.
|
||||
names above a certain length, these table names will be automatically
|
||||
truncated to 64 characters and a uniqueness hash will be used. This means you
|
||||
might see table names like ``author_books_9cdf4``; this is perfectly normal.
|
||||
You can manually provide the name of the join table using the
|
||||
:attr:`~ManyToManyField.db_table` option.
|
||||
|
||||
.. _manytomany-arguments:
|
||||
|
||||
@@ -889,8 +889,9 @@ that control how the relationship functions.
|
||||
|
||||
Same as :attr:`ForeignKey.limit_choices_to`.
|
||||
|
||||
``limit_choices_to`` has no effect when used on a ``ManyToManyField`` with
|
||||
an intermediate table.
|
||||
``limit_choices_to`` has no effect when used on a ``ManyToManyField`` with a
|
||||
custom intermediate table specified using the
|
||||
:attr:`~ManyToManyField.through` paramter.
|
||||
|
||||
.. attribute:: ManyToManyField.symmetrical
|
||||
|
||||
@@ -920,7 +921,8 @@ that control how the relationship functions.
|
||||
use.
|
||||
|
||||
The most common use for this option is when you want to associate
|
||||
:ref:`extra data with a many-to-many relationship <intermediary-manytomany>`.
|
||||
:ref:`extra data with a many-to-many relationship
|
||||
<intermediary-manytomany>`.
|
||||
|
||||
.. attribute:: ManyToManyField.db_table
|
||||
|
||||
|
||||
@@ -188,6 +188,18 @@ almost always do the right thing and trying to override that will lead to
|
||||
errors that are difficult to track down. This feature is for advanced use
|
||||
only.
|
||||
|
||||
Deleting objects
|
||||
================
|
||||
|
||||
.. method:: Model.delete()
|
||||
|
||||
Issues a SQL ``DELETE`` for the object. This only deletes the object in the
|
||||
database; the Python instance will still be around, and will still have data
|
||||
in its fields.
|
||||
|
||||
For more details, including how to delete objects in bulk, see
|
||||
:ref:`topics-db-queries-delete`.
|
||||
|
||||
.. _model-instance-methods:
|
||||
|
||||
Other model instance methods
|
||||
|
||||
@@ -4,11 +4,32 @@
|
||||
Related objects reference
|
||||
=========================
|
||||
|
||||
Extra methods on managers when used in a ForeignKey context
|
||||
===========================================================
|
||||
|
||||
.. currentmodule:: django.db.models
|
||||
|
||||
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:
|
||||
|
||||
* The "other side" of a ``ForeignKey`` relation. That is::
|
||||
|
||||
class Reporter(models.Model):
|
||||
...
|
||||
|
||||
class Article(models.Model):
|
||||
reporter = models.ForeignKey(Reporter)
|
||||
|
||||
In the above example, the methods below will be available on
|
||||
the manager ``reporter.article_set``.
|
||||
|
||||
* Both sides of a ``ManyToManyField`` relation::
|
||||
|
||||
class Topping(models.Model):
|
||||
...
|
||||
|
||||
class Pizza(models.Model):
|
||||
toppings = models.ManyToManyField(Topping)
|
||||
|
||||
In this example, the methods below will be available both on
|
||||
``topping.pizza_set`` and on ``pizza.toppings``.
|
||||
|
||||
.. method:: QuerySet.add(obj1, [obj2, ...])
|
||||
|
||||
Adds the specified model objects to the related object set.
|
||||
|
||||
Reference in New Issue
Block a user