本文整理汇总了Python中olympia.reviewers.models.ReviewerScore.award_moderation_points方法的典型用法代码示例。如果您正苦于以下问题:Python ReviewerScore.award_moderation_points方法的具体用法?Python ReviewerScore.award_moderation_points怎么用?Python ReviewerScore.award_moderation_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类olympia.reviewers.models.ReviewerScore
的用法示例。
在下文中一共展示了ReviewerScore.award_moderation_points方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete
# 需要导入模块: from olympia.reviewers.models import ReviewerScore [as 别名]
# 或者: from olympia.reviewers.models.ReviewerScore import award_moderation_points [as 别名]
def delete(self, user_responsible=None):
if user_responsible is None:
user_responsible = self.user
rating_was_moderated = False
# Log deleting ratings to moderation log,
# except if the author deletes it
if user_responsible != self.user:
# Remember moderation state
rating_was_moderated = True
from olympia.reviewers.models import ReviewerScore
activity.log_create(
amo.LOG.DELETE_RATING, self.addon, self, user=user_responsible,
details=dict(
body=unicode(self.body),
addon_id=self.addon.pk,
addon_title=unicode(self.addon.name),
is_flagged=self.ratingflag_set.exists()))
for flag in self.ratingflag_set.all():
flag.delete()
log.info(u'Rating deleted: %s deleted id:%s by %s ("%s")',
user_responsible.name, self.pk, self.user.name,
unicode(self.body))
self.update(deleted=True)
# Force refreshing of denormalized data (it wouldn't happen otherwise
# because we're not dealing with a creation).
self.update_denormalized_fields()
if rating_was_moderated:
ReviewerScore.award_moderation_points(user_responsible,
self.addon,
self.pk)
示例2: ratings_moderation_log_detail
# 需要导入模块: from olympia.reviewers.models import ReviewerScore [as 别名]
# 或者: from olympia.reviewers.models.ReviewerScore import award_moderation_points [as 别名]
def ratings_moderation_log_detail(request, id):
log = get_object_or_404(ActivityLog.objects.moderation_events(), pk=id)
review = None
# I really cannot express the depth of the insanity incarnate in
# our logging code...
if len(log.arguments) > 1 and isinstance(log.arguments[1], Rating):
review = log.arguments[1]
is_admin = acl.action_allowed(request,
amo.permissions.REVIEWS_ADMIN)
can_undelete = review and review.deleted and (
is_admin or request.user.pk == log.user.pk)
if request.method == 'POST':
# A Form seems overkill for this.
if request.POST['action'] == 'undelete':
if not can_undelete:
raise PermissionDenied
ReviewerScore.award_moderation_points(
log.user, review.addon, review.id, undo=True)
review.undelete()
return redirect('reviewers.ratings_moderation_log.detail', id)
data = context(request, log=log, can_undelete=can_undelete)
return render(request, 'reviewers/moderationlog_detail.html', data)
示例3: approve
# 需要导入模块: from olympia.reviewers.models import ReviewerScore [as 别名]
# 或者: from olympia.reviewers.models.ReviewerScore import award_moderation_points [as 别名]
def approve(self, user):
from olympia.reviewers.models import ReviewerScore
activity.log_create(
amo.LOG.APPROVE_RATING, self.addon, self, user=user, details=dict(
body=unicode(self.body),
addon_id=self.addon.pk,
addon_title=unicode(self.addon.name),
is_flagged=self.ratingflag_set.exists()))
for flag in self.ratingflag_set.all():
flag.delete()
self.editorreview = False
# We've already logged what we want to log, no need to pass
# user_responsible=user.
self.save()
ReviewerScore.award_moderation_points(user, self.addon, self.pk)