summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@gmail.com>2015-02-14 01:55:36 +0700
committerLoic Bistuer <loic.bistuer@gmail.com>2015-02-14 02:28:24 +0700
commit18c0aaa9123579375294fcc4a8ee7e3530176b88 (patch)
tree00547fa5e4b2f3f975a11ddd8203fe971f5f95c2 /docs/ref
parent5c995dcfc251b55284e1ef16545acd2acad6be04 (diff)
Fixed #24289 -- Reversed usage of Field.many_to_one and one_to_many.
Thanks Carl Meyer and Tim Graham for the reviews and to all involved in the discussion.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/fields.txt20
-rw-r--r--docs/ref/models/meta.txt10
2 files changed, 15 insertions, 15 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 4eb16d4345..ad7d099621 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -1810,16 +1810,6 @@ relation. These attribute are present on all fields; however, they will only
have meaningful values if the field is a relation type
(:attr:`Field.is_relation=True <Field.is_relation>`).
-.. attribute:: Field.one_to_many
-
- Boolean flag that is ``True`` if the field has a one-to-many relation, such
- as a ``ForeignKey``; ``False`` otherwise.
-
-.. attribute:: Field.one_to_one
-
- Boolean flag that is ``True`` if the field has a one-to-one relation, such
- as a ``OneToOneField``; ``False`` otherwise.
-
.. attribute:: Field.many_to_many
Boolean flag that is ``True`` if the field has a many-to-many relation;
@@ -1829,9 +1819,19 @@ have meaningful values if the field is a relation type
.. attribute:: Field.many_to_one
Boolean flag that is ``True`` if the field has a many-to-one relation, such
+ as a ``ForeignKey``; ``False`` otherwise.
+
+.. attribute:: Field.one_to_many
+
+ Boolean flag that is ``True`` if the field has a one-to-many relation, such
as a ``GenericRelation`` or the reverse of a ``ForeignKey``; ``False``
otherwise.
+.. attribute:: Field.one_to_one
+
+ Boolean flag that is ``True`` if the field has a one-to-one relation, such
+ as a ``OneToOneField``; ``False`` otherwise.
+
.. attribute:: Field.related_model
Points to the model the field relates to. For example, ``Author`` in
diff --git a/docs/ref/models/meta.txt b/docs/ref/models/meta.txt
index fdad7b2ad0..ec088e64fa 100644
--- a/docs/ref/models/meta.txt
+++ b/docs/ref/models/meta.txt
@@ -213,7 +213,7 @@ can be made to convert your code to the new API:
for f in MyModel._meta.get_fields()
if not f.is_relation
or f.one_to_one
- or (f.one_to_many and f.related_model)
+ or (f.many_to_one and f.related_model)
]
* ``MyModel._meta.get_concrete_fields_with_model()``::
@@ -224,7 +224,7 @@ can be made to convert your code to the new API:
if f.concrete and (
not f.is_relation
or f.one_to_one
- or (f.one_to_many and f.related_model)
+ or (f.many_to_one and f.related_model)
)
]
@@ -240,7 +240,7 @@ can be made to convert your code to the new API:
[
f for f in MyModel._meta.get_fields()
- if f.many_to_one and f.auto_created
+ if f.one_to_many and f.auto_created
]
* ``MyModel._meta.get_all_related_objects_with_model()``::
@@ -248,7 +248,7 @@ can be made to convert your code to the new API:
[
(f, f.model if f.model != MyModel else None)
for f in MyModel._meta.get_fields()
- if f.many_to_one and f.auto_created
+ if f.one_to_many and f.auto_created
]
* ``MyModel._meta.get_all_related_many_to_many_objects()``::
@@ -274,7 +274,7 @@ can be made to convert your code to the new API:
for field in MyModel._meta.get_fields()
# For complete backwards compatibility, you may want to exclude
# GenericForeignKey from the results.
- if not (field.one_to_many and field.related_model is None)
+ if not (field.many_to_one and field.related_model is None)
)))
This provides a 100% backwards compatible replacement, ensuring that both