1 from forum.badges.base import CountableAbstractBadge
2 from forum.models import Question, Tag
3 from forum import const
4 from django.utils.translation import ugettext as _
7 class BugBusterBadge(CountableAbstractBadge):
8 type = const.SILVER_BADGE
9 description = _('Got %s upvotes in a question tagged with "bug"') % str(settings.BUG_BUSTER_VOTES_UP)
13 def handler(instance):
15 bug_tag = Tag.objects.get(name='bug')
16 if bug_tag in instance.tags.all():
17 self.award_badge(instance.author, instance)
21 super(BugBusterBadge, self).__init__(Question, 'vote_up_count', settings.BUG_BUSTER_VOTES_UP, handler)