示例#1
0
 def trigger_hooks(self, threaded, new=True):
     from forum.models import CustomBadge
     CustomBadge.load_custom_badges()
     if threaded:
         thread = Thread(target=trigger_hooks, args=[self, Action.hooks, new])
         thread.setDaemon(True)
         thread.start()
     else:
         trigger_hooks(self, Action.hooks, new)
示例#2
0
def badges(request):
    CustomBadge.load_custom_badges()
    badges = Badge.objects.all()

    if request.user.is_authenticated():
        my_badges = Award.objects.filter(user=request.user).values('badge_id').distinct()
    else:
        my_badges = []

    return pagination.paginated(request, ('badges', BadgesPaginatorContext()), {
        'badges' : badges,
        'mybadges' : my_badges,
    })