summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2006-08-17 00:02:51 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2006-08-17 00:02:51 +0000
commit7fe6fd75ba12b1219e2f4846c7dd3972577bd4f5 (patch)
tree394a75e0ad7630bd9e742344a36fbc1c33ba7476 /docs
parent518d406e53a7417385a1a2e10bb5110b67d28fac (diff)
Clarified documentation regarding string-form model references.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3597 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/model-api.txt10
1 files changed, 7 insertions, 3 deletions
diff --git a/docs/model-api.txt b/docs/model-api.txt
index c4d19db3bf..84337a0ae3 100644
--- a/docs/model-api.txt
+++ b/docs/model-api.txt
@@ -686,8 +686,9 @@ you can use the name of the model, rather than the model object itself::
class Manufacturer(models.Model):
# ...
-Note, however, that support for strings around model names in ``ForeignKey`` is
-quite new, and it can be buggy in some cases.
+Note, however, that you can only use strings to refer to models in the same
+models.py file - you cannot use a string to reference a model in a different
+application, or to reference a model that has been imported from elsewhere.
Behind the scenes, Django appends ``"_id"`` to the field name to create its
database column name. In the above example, the database table for the ``Car``
@@ -809,7 +810,10 @@ here's how you'd represent that::
As with ``ForeignKey``, a relationship to self can be defined by using the
string ``'self'`` instead of the model name, and you can refer to as-yet
-undefined models by using a string containing the model name.
+undefined models by using a string containing the model name. However, you
+can only use strings to refer to models in the same models.py file - you
+cannot use a string to reference a model in a different application, or to
+reference a model that has been imported from elsewhere.
It's suggested, but not required, that the name of a ``ManyToManyField``
(``toppings`` in the example above) be a plural describing the set of related