本文整理匯總了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()