1 from django.utils.translation import ugettext as _
2 from forum.badges.base import AbstractBadge
3 from forum.models import Badge, Tag
4 from forum.actions import VoteUpAction
7 class BugBuster(AbstractBadge):
10 description = _('Got %s upvotes in a question tagged with "bug"') % settings.BUG_BUSTER_VOTES_UP
11 listen_to = (VoteUpAction, )
13 def award_to(self, action):
14 if action.node.node_type == "question" and int(action.node.score) == int(settings.BUG_BUSTER_VOTES_UP):
16 bug = Tag.objects.get(name="bug")
17 if bug in action.node.tags.all():
18 return action.node.author