Django

Code

Changeset 7159

Show
Ignore:
Timestamp:
02/26/08 15:18:34 (6 months ago)
Author:
jacob
Message:

Added documentation about the "app.Model" relation syntax introduced by [7185]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/model-api.txt

    r7119 r7159  
    785785        # ... 
    786786 
    787 Note, however, that you can only use strings to refer to models in the same 
    788 models.py file -- you cannot use a string to reference a model in a different 
    789 application, or to reference a model that has been imported from elsewhere. 
     787Note, however, that this only refers to models in the same models.py file -- you 
     788cannot use a string to reference a model defined in another application or 
     789imported from elsewhere. 
     790 
     791**New in Django development version:** to refer to models defined in another 
     792application, you must instead explicitially specify the application label. That 
     793is, if the ``Manufacturer`` model above is defined in another application called 
     794``production``, you'd need to use:: 
     795 
     796    class Car(models.Model): 
     797        manufacturer = models.ForeignKey('production.Manufacturer') 
    790798 
    791799Behind the scenes, Django appends ``"_id"`` to the field name to create its