错误:一个或多个模型未验证:Django + South,shemamigration generic --auto

时间:2011-11-14 15:20:10

标签: django migration django-south

我试图运行shemamigration generic --auto

    generic.articletocategory: 'article' has a relation with model generic.Article, which has either not been installed or is abstract.
    generic.category: 'articles' is a manually-defined m2m relation through model ArticleToCategory, which does not have foreign keys to Article and Category


class ArticleToCategory(m.Model):    
    article = m.ForeignKey('generic.Article')
    category = m.ForeignKey('generic.Category')

    class Meta:
        app_label = 'generic' 
        db_table = 'articles_to_categories'
        verbose_name_plural = 'ArticlesToCategories'

class Article(m.Model):
    pass


class Category(MPTTModel):
    parent = TreeForeignKey('self', null=True, blank=True, related_name='children')

    # relationships
    articles = m.ManyToManyField('generic.Article', through='generic.ArticleToCategory')

解决!

Meta类中的文章有app_label = 'Generic'而不是'generic'

1 个答案:

答案 0 :(得分:1)

Meta类中的文章有app_label =' Generic'而不是' generic'