出于某种原因,我无法让这个模型彼此建立任何关系?而 Aptana 给了我红线和错误说 Test1 和 Test2 是未定义的变量...起初我认为它只是 aptana 搞砸了所以我决定同步它但它实际上给了我错误说 NameError: name Test1 is not defined?可能是什么原因?提前致谢!
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from userena.models import UserenaBaseProfile
class MyProfile(UserenaBaseProfile):
user = models.OneToOneField(User, unique=True, verbose_name=_('User'), related_name='my_profile')
favourite_snack = models.CharField(_('favourite snack'), max_length=5)
test1 = models.ManyToManyField(Test1)
class Test1(models.Model):
name = models.CharField(max_length=255, blank=False)
test2 = models.OneToOneField(Test2)
class Test2(models.Model):
name = models.CharField()