这是我的模型:
class BaseModelTalk(models.Model):
name = models.CharField('Name', max_length = 100)
slug = models.SlugField('Slug', blank = True)
creator = models.ForeignKey('person.Person')
date_created = models.DateTimeField(default = now)
objects = CustomTalkManager()
class Meta:
abstract = True
def save(self, *args, **kwargs):
if not self.id:
self.slug = slugify(self.name)
super(BaseModelTalk, self).save(*args, **kwargs)
def __unicode__(self):
return u'%s' % self.slug
class Talk(BaseModelTalk):
tags = TaggableManager()
description = models.TextField('Talk description')
class Meta:
verbose_name = 'Talk'
verbose_name_plural = 'Talks'
class ThreadTextRating(RatedItemBase):
content_object = models.ForeignKey('talk.ThreadText')
class ThreadImageRating(RatedItemBase):
content_object = models.ForeignKey('talk.ThreadImage')
class ThreadLinkRating(RatedItemBase):
content_object = models.ForeignKey('talk.ThreadLink')
class Thread(BaseModelTalk):
THREAD_TYPE = (('text', 'Text'),
('image', 'Image'),
('link', 'Link'))
type = models.CharField('Thread\'s type', max_length = 5, choices = THREAD_TYPE, blank = True, null = True)
class Meta:
abstract = True
class ThreadText(Thread):
ratings = Ratings(ThreadTextRating)
talk = models.ForeignKey('talk.Talk', related_name = 'text_threads')
content = models.TextField('Thread\'s context')
class Meta:
verbose_name = 'Text'
verbose_name_plural = 'Text\'s'
class ThreadImage(Thread):
ratings = Ratings(ThreadImageRating)
talk = models.ForeignKey('talk.Talk', related_name = 'image_threads')
image = ImageField('Thread\'s image', upload_to = 'thread/image/')
class Meta:
verbose_name = 'Image'
verbose_name_plural = 'Image\'s'
class ThreadLink(Thread):
ratings = Ratings(ThreadLinkRating)
talk = models.ForeignKey('talk.Talk', related_name = 'link_threads')
link = models.URLField('Thread\'s link')
class Meta:
verbose_name = 'Link'
verbose_name_plural = 'Link\'s'
每次我运行syncdb
时,我都会收到一个错误:django.db.utils.DatabaseError: no such table: talk_basemodeltalk
。
我已经将应用程序放在我的settings.py
哪个是talk
.
我真的不知道是什么原因造成的,唯一的线索是如果我class Meta
评论BaseModelTalk
那行,我没有错误。