好的,在我的 models.py 文件中,我刚刚创建了这个:
class PL(models.Model):
created = models.DateTimeField(default=timezone.now)
owner = models.ForeignKey(User, related_name='PL')
text = models.CharField(max_length=2000, blank=True)
rating = models.IntegerField(default=0)
pal = models.ManyToManyField(PS, blank=True, null=True)
class Meta:
verbose_name = "PL text"
def __unicode__(self):
return self.user
class PS(models.Model):
Original = models.ForeignKey(PL, related_name='OPL', blank=True)
rating = models.IntegerField(default=0)
word = models.CharField(max_length=50, blank=True)
def __unicode__(self):
return "Word: %s" % (self.word)
但我不断收到: NameError: name 'PS' is not defined
为什么会这样?