本文整理汇总了Python中taggit.managers.TaggableManager.contribute_to_class方法的典型用法代码示例。如果您正苦于以下问题:Python TaggableManager.contribute_to_class方法的具体用法?Python TaggableManager.contribute_to_class怎么用?Python TaggableManager.contribute_to_class使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taggit.managers.TaggableManager
的用法示例。
在下文中一共展示了TaggableManager.contribute_to_class方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post_template
# 需要导入模块: from taggit.managers import TaggableManager [as 别名]
# 或者: from taggit.managers.TaggableManager import contribute_to_class [as 别名]
def post_template(self):
return 'tumblelog/post/%s.html' % slugify(self.__class__.__name__)
@property
def rss_template(self):
return [
'tumblelog/rss/%s.html' % slugify(self.__class__.__name__),
self.post_template,
]
# Add the django-taggit manager, if taggit is installed
if USE_TAGGIT:
from taggit.managers import TaggableManager
taggit_manager = TaggableManager()
taggit_manager.contribute_to_class(BasePostType, 'tags')
class BaseOembedPostType(BasePostType):
"""
Abstract post type base classes whose subclasses retrieve data from an
oEmbed endpoint.
"""
caption = models.TextField(_('Caption'),
blank=True,
null=True,
help_text=TEXTFIELD_HELP_TEXT
)
version = models.CharField(_('oEmbed Version'), max_length=3, null=True, \
blank=True, editable=True)
provider_name = models.CharField(_('oEmbed Provider Name'), \