【发布时间】:2013-03-06 19:18:31
【问题描述】:
假设我有这个 Django 设置:
appA - models.py
- views.py
- etc...
global - models.py
我想要的是从 appA.models 中的 global.models 导入模型,以便它们被 syncdb 和 south 视为普通的 appA 模型。
global.models:
from django.db import models
class Foo(models.Model):
#django model stuff
appA.models: 尝试1:
from global.models import *
>>manage.py schemamigration appA --auto
>>does not see Foo
尝试 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.
实现此目的的正确方法是什么?
【问题讨论】:
标签: django django-south django-orm django-syncdb