本文整理汇总了Python中comments.models.Comment.get_for_object方法的典型用法代码示例。如果您正苦于以下问题:Python Comment.get_for_object方法的具体用法?Python Comment.get_for_object怎么用?Python Comment.get_for_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comments.models.Comment
的用法示例。
在下文中一共展示了Comment.get_for_object方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render_comment_list
# 需要导入模块: from comments.models import Comment [as 别名]
# 或者: from comments.models.Comment import get_for_object [as 别名]
def render_comment_list(context, obj):
return {
'qs': Comment.get_for_object(obj),
'content_type': ContentType.objects.get_for_model(obj),
'obj': obj,
'perms': context['perms'],
'user': context['user']
}
示例2: render_comment_list
# 需要导入模块: from comments.models import Comment [as 别名]
# 或者: from comments.models.Comment import get_for_object [as 别名]
def render_comment_list(context, obj):
return {
'next_page': context['request'].get_full_path(),
'qs': Comment.get_for_object(obj),
'content_type': ContentType.objects.get_for_model(obj),
'obj': obj,
'perms': context['perms'],
'user': context['user']
}
示例3: prepare
# 需要导入模块: from comments.models import Comment [as 别名]
# 或者: from comments.models.Comment import get_for_object [as 别名]
def prepare(self, obj):
self.prepared_data = super(VideoIndex, self).prepare(obj)
langs = obj.subtitlelanguage_set.exclude(language=u'')
self.prepared_data['video_language'] = obj.language and '%s ++++++++++' % obj.language or ''
self.prepared_data['languages'] = ['%s ++++++++++' % lang.language for lang in langs if lang.latest_subtitles()]
self.prepared_data['comments_count'] = Comment.get_for_object(obj).count()
self.prepared_data['languages_count'] = obj.subtitlelanguage_set.count()
self.prepared_data['contributors_count'] = User.objects.filter(subtitleversion__language__video=obj).distinct().count()
self.prepared_data['activity_count'] = obj.action_set.count()
return self.prepared_data
示例4: get_comment_count
# 需要导入模块: from comments.models import Comment [as 别名]
# 或者: from comments.models.Comment import get_for_object [as 别名]
def get_comment_count(obj):
return Comment.get_for_object(obj).count()