def test_get_badge(self): thermostat_badge = get_badge('dial-down-thermostat-action-badge') self.failUnlessEqual(thermostat_badge.name, 'Dial down your thermostat') replace_windows = get_badge('replace-your-windows-action-badge') self.failUnlessEqual(replace_windows.name, 'Replace an old window') trendsetter = get_badge('trendsetter-badge') self.failUnlessEqual(trendsetter.name, 'Trendsetter') comment_badge = get_badge('gift-of-gab-badge') self.failUnlessEqual(comment_badge.name, 'Gift of Gab') momentum_badge = get_badge('momentum-builder-badge') self.failUnlessEqual(momentum_badge.name, 'Momentum Builder')
def detail(request, slug): nav_selected = "badges" badge = get_badge(slug) if not badge: raise Http404('A badge %s does not exist' % slug) awardees = BadgeAward.objects.select_related().filter(slug=slug) return render_to_response('badges/detail.html', locals(), context_instance=RequestContext(request))