I have 2 app inside a django project. I want to import a model from one app to another. But it gives me
NameError: name 'JobGenre' is not defined
when I try to syncdb
In customer.models
from job.models import JobGenre
class Worker(Costumer):
keyword=models.ForeignKey(JobGenre, null=True)
and in job.models
class JobGenre(models.Model):
genre=models.CharField(max_length=40)
if i use
keyword=models.ForeignKey('job.models.JobGenre', null=True)
it gives
Error: One or more models did not validate: costumer.worker: 'keyword' has a relation with model job.models.JobGenre, which has either not been installed or is abstract.
What should I do in this situation?
keyword=models.ForeignKey('job.models.JobGenre', null=True)
Looks incorrect to me.
Try instead:
keyword.models.ForeignKey('job.JobGenre', null=True)