37👍
From the docs:
To refer to models defined in another
application, you can explicitly
specify a model with the full
application label. For example, 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')
This sort of reference can be useful
when resolving circular import
dependencies between two applications.
So for your apps, try changing e.g.
location = models.ForeignKey(Location)
to
location = models.ForeignKey('Location')
Note that if this model is in a different app then you need to specify that too (thanks @Bran for pointing this out), e.g.
location = models.ForeignKey('teacher.Location')
Source:stackexchange.com