I want to test an abstract model that has a ForeignKey
to a model defined in another app:
from otherapp.models import Person
class ModelMaster(models.Model):
slave = models.ForeignKey(Person)
class Meta:
abstract = True
The problems arises when I just define a model inheriting from ModelMaster
in tests.py
:
from .models import ModelMaster
class Master(ModelMaster):
pass
The python manage.py test
breaks with the following error:
django.db.utils.ProgrammingError: relation "otherapp_person" does not exist
But when I define the Person
model in the same app as the ModelMaster
, there is no error.
Is there a way to make it working, so that model from another app referenced in an abstract model is properly recognised during the test?
Aucun commentaire:
Enregistrer un commentaire