diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-02-28 15:48:19 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-02-28 15:48:19 +0000 |
| commit | 2f2908d7b5f5e4179c6ae185e3969fd66050ad23 (patch) | |
| tree | e9243d1d90c17a167312feccd2c0dd9e25344286 /docs | |
| parent | 7c54780497aafc0749fa3f9e8d77f80e1f7b7d83 (diff) | |
queryset-refactor: Merged from trunk up to [7168].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7173 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -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 abf69835be..2d8d984237 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`` |
