diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2008-03-13 06:14:26 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2008-03-13 06:14:26 +0000 |
| commit | bfc5660c472ac2e52cc4fdec78315c87b01357de (patch) | |
| tree | 887c25472201f310cc5b95cb236cf5492af9bf57 /docs/model-api.txt | |
| parent | 304642769c5e0e704d0204bc241574c8c491cdf5 (diff) | |
newforms-admin: Merged from trunk up to [7232]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7233 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/model-api.txt')
| -rw-r--r-- | docs/model-api.txt | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/docs/model-api.txt b/docs/model-api.txt index 7eb0fdbb28..66fa63e3c6 100644 --- a/docs/model-api.txt +++ b/docs/model-api.txt @@ -784,9 +784,17 @@ you can use the name of the model, rather than the model object itself:: class Manufacturer(models.Model): # ... -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. +Note, however, that this only refers to models in the same models.py file -- you +cannot use a string to reference a model defined in another application or +imported from elsewhere. + +**New in Django development version:** to refer to models defined in another +application, you must instead explicitially specify the application label. That +is, if the ``Manufacturer`` model above is defined in another application called +``production``, you'd need to use:: + + class Car(models.Model): + manufacturer = models.ForeignKey('production.Manufacturer') 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`` |
