Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #11864 -- Improved the "see also" section of the many-t…

…o-one model topic guide to more clearly connect people to the backwards-related objects docs and to the correct point in the model tests for sample code (since the doctests went away). Thanks to dwillis for the work on the patch.

Backport of [15758] from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15759 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 64011c8e5a5b7c78232b242e68e3a704ec42c3df 1 parent 5273952
authored March 04, 2011

Showing 1 changed file with 14 additions and 10 deletions. Show diff stats Hide diff stats

  1. 24  docs/topics/db/models.txt
24  docs/topics/db/models.txt
@@ -284,7 +284,7 @@ relationships: many-to-one, many-to-many and one-to-one.
284 284
 Many-to-one relationships
285 285
 ~~~~~~~~~~~~~~~~~~~~~~~~~
286 286
 
287  
-To define a many-to-one relationship, use :class:`~django.db.models.ForeignKey`.
  287
+To define a many-to-one relationship, use :class:`django.db.models.ForeignKey`.
288 288
 You use it just like any other :class:`~django.db.models.Field` type: by
289 289
 including it as a class attribute of your model.
290 290
 
@@ -318,14 +318,18 @@ whatever you want. For example::
318 318
 
319 319
 .. seealso::
320 320
 
321  
-    See the `Many-to-one relationship model example`_ for a full example.
  321
+    :class:`~django.db.models.ForeignKey` fields accept a number of extra
  322
+    arguments which are explained in :ref:`the model field reference
  323
+    <foreign-key-arguments>`. These options help define how the relationship
  324
+    should work; all are optional.
322 325
 
323  
-.. _Many-to-one relationship model example: http://code.djangoproject.com/browser/django/trunk/tests/modeltests/many_to_one/models.py
  326
+    For details on accessing backwards-related objects, see the
  327
+    `Following relationships backward example`_.
  328
+    
  329
+    For sample code, see the `Many-to-one relationship model tests`_.
324 330
 
325  
-:class:`~django.db.models.ForeignKey` fields also accept a number of extra
326  
-arguments which are explained in :ref:`the model field reference
327  
-<foreign-key-arguments>`. These options help define how the relationship should
328  
-work; all are optional.
  331
+    .. _Following relationships backward example: http://docs.djangoproject.com/en/dev/topics/db/queries/#backwards-related-objects
  332
+    .. _Many-to-one relationship model tests: http://code.djangoproject.com/browser/django/trunk/tests/modeltests/many_to_one
329 333
 
330 334
 Many-to-many relationships
331 335
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -929,7 +933,7 @@ The second type of model inheritance supported by Django is when each model in
929 933
 the hierarchy is a model all by itself. Each model corresponds to its own
930 934
 database table and can be queried and created individually. The inheritance
931 935
 relationship introduces links between the child model and each of its parents
932  
-(via an automatically-created :class:`~django.db.models.fields.OneToOneField`).
  936
+(via an automatically-created :class:`~django.db.models.OneToOneField`).
933 937
 For example::
934 938
 
935 939
     class Place(models.Model):
@@ -1210,7 +1214,7 @@ Field name "hiding" is not permitted
1210 1214
 
1211 1215
 In normal Python class inheritance, it is permissible for a child class to
1212 1216
 override any attribute from the parent class. In Django, this is not permitted
1213  
-for attributes that are :class:`~django.db.models.fields.Field` instances (at
  1217
+for attributes that are :class:`~django.db.models.Field` instances (at
1214 1218
 least, not at the moment). If a base class has a field called ``author``, you
1215 1219
 cannot create another model field called ``author`` in any class that inherits
1216 1220
 from that base class.
@@ -1223,7 +1227,7 @@ difference between Django model inheritance and Python class inheritance isn't
1223 1227
 arbitrary.
1224 1228
 
1225 1229
 This restriction only applies to attributes which are
1226  
-:class:`~django.db.models.fields.Field` instances. Normal Python attributes
  1230
+:class:`~django.db.models.Field` instances. Normal Python attributes
1227 1231
 can be overridden if you wish. It also only applies to the name of the
1228 1232
 attribute as Python sees it: if you are manually specifying the database
1229 1233
 column name, you can have the same column name appearing in both a child and

0 notes on commit 64011c8

Please sign in to comment.
Something went wrong with that request. Please try again.