Lets say I have this Django setup:
appA - models.py
- views.py
- etc...
global - models.py
What I want is import the models from global.models
in appA.models
so that they are treated as a normal appA
models by syncdb and south.
global.models:
from django.db import models
class Foo(models.Model):
#django model stuff
appA.models: try 1:
from global.models import *
>>manage.py schemamigration appA --auto
>>does not see Foo
try 2:
from global.models import Foo
class Foo(Foo):
pass
>>manage.py schemamigration appA --auto
>>Error: One or more models did not validate:
>>appA.Foo: 'foo_ptr' has a relation with model <class 'global.models.Foo'>, which has either not been installed or is abstract.
What is the correct way to accomplish this?
from .models import Foo
class Foo(models.Model):
#stuff
class Meta:
abstract = True