如何在帖子中显示类别名称

时间:2019-05-20 07:15:04

标签: python-3.x django-models mezzanine

我正在尝试使用夹层开发博客网站, 我想在帖子详细信息页面中获得类别名称。

显示blog.BlogCategory.None而不是类别名称。

我试图按照以下链接 Mezzanine BlogCategory parsing categories

from mezzanine.blog.models import BlogCategory
from mezzanine.blog.models import BlogPost
post = BlogPost.objects.all()
for post_list in post:
    print(post_list.categories)

我希望使用体育和科技等类别名称,但会显示 blog.BlogCategory.None

此处BlogCategory模型继承自Slugged模型 和BlogPost模型与BlogCategory有很多关系。

0 个答案:

没有答案
相关问题