所以,我有帖子和类别:
class Post(models.Model):
...
category = models.ForeignKey(Category)
def __unicode__(self):
return self.title
class Category(models.Model):
category = models.CharField(max_length = 30, unique=True)
id_post = models.ForeignKey(Post)
def __unicode__(self):
return self.category
我写
python manage.py 验证
和 NameError: Name Category
is not defined。为什么???
我正在使用 sqllite,谢谢!