Permalink
Browse files

Clarified default name of M2M relationship DB table.

  • Loading branch information...
1 parent f758bda commit 50837434dbafe7d542aa4bd499f50314b1bac36f @ramiro ramiro committed Jul 25, 2012
Showing with 13 additions and 12 deletions.
  1. +11 −11 docs/ref/models/fields.txt
  2. +2 −1 docs/topics/db/models.txt
View
22 docs/ref/models/fields.txt
@@ -1074,15 +1074,14 @@ the model is related. This works exactly the same as it does for
Database Representation
~~~~~~~~~~~~~~~~~~~~~~~
-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 name of the many-to-many field and the model
-that contains it. Since some databases don't support table 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.
+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
+name of the many-to-many field and the name of the table for the model that
+contains it. Since some databases don't support table 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:
@@ -1138,8 +1137,9 @@ that control how the relationship functions.
.. attribute:: ManyToManyField.db_table
The name of the table to create for storing the many-to-many data. If this
- is not provided, Django will assume a default name based upon the names of
- the two tables being joined.
+ is not provided, Django will assume a default name based upon the names of:
+ the table for the model defining the relationship and the name of the field
+ itself.
.. _ref-onetoone:
View
3 docs/topics/db/models.txt
@@ -384,7 +384,8 @@ Extra fields on many-to-many relationships
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When you're only dealing with simple many-to-many relationships such as
-mixing and matching pizzas and toppings, a standard :class:`~django.db.models.ManyToManyField` is all you need. However, sometimes
+mixing and matching pizzas and toppings, a standard
+:class:`~django.db.models.ManyToManyField` is all you need. However, sometimes
you may need to associate data with the relationship between two models.
For example, consider the case of an application tracking the musical groups

0 comments on commit 5083743

Please sign in to comment.