Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added documentation about the "app.Model" relation syntax introduced …

…by [7185]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7159 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 00f051985933abd32c545f54487de571df813c67 1 parent df5fef3
@jacobian jacobian authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 docs/model-api.txt
View
14 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``
Please sign in to comment.
Something went wrong with that request. Please try again.