<p>I'm wondering if it's possible to define a foreign key in a models.py file in Django that is a reference to a table in another app?</p>

<p>In other words, I have two apps, called cf and profiles, and in cf/models.py I have (amongst other things):</p>

<pre><code>class Movie(models.Model):
    title = models.CharField(max_length=255)
</code></pre>

<p>and in profiles/models.py I want to have:</p>

<pre><code>class MovieProperty(models.Model):
    movie = models.ForeignKey(Movie)
</code></pre>

<p>But I can't get it to work. I've tried:</p>

<pre><code>    movie = models.ForeignKey(cf.Movie)
</code></pre>

<p>and I've tried importing cf.Movie at the beginning of models.py, but I always get errors, such as:</p>

<pre><code>NameError: name 'User' is not defined
</code></pre>

<p>Am I breaking the rules by trying to tie two apps together in this way, or have I just got the syntax wrong?</p>

OK - I've figured it out. You can do it, you just have to use the right
```
import
```
syntax. The correct syntax is:
```
```
from prototype.cf.models import Movie
```
```
My mistake was not specifying the
```
.models
```
part of that line. D'oh!