Django AttributeError' Tag'对象没有属性'摘要'

时间:2018-02-27 04:04:08

标签: python-3.x django-models django-rest-framework attributeerror

每当我尝试添加新标记时,都会遇到此错误。我试着去谷歌并阅读一些SO帖子,但对我来说没什么用。

以下是我的2个型号:

摘要:

class Summary(models.Model):

    question_text = models.CharField(max_length=255)
    created_at = models.DateTimeField(auto_now_add=True)
    url = models.URLField(null=False)
    cover_image = models.CharField(max_length=255)
    tags = models.ManyToManyField('Tag', related_name='summaries', blank=True)
    userProfileSummary = models.ManyToManyField('UserProfile', through='UserProfileSummary')

    def __str__(self):
        return self.question_text

    class Meta:
        verbose_name_plural = "Summaries"

标签:

class Tag(models.Model):

    name = models.CharField(max_length=255)
    description = models.TextField(null=True, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.name

模型/的初始化的.py:

...
from .tag import Tag
from .summary import Summary


__all__ = (
     ...
    'Tag',
    'Summary',
)

错误: enter image description here

拜托,我错过了什么?

0 个答案:

没有答案