(sender, **kwargs)
Initializes the badges
Initializes the badges
Initializes the badges
def init_awards(sender, **kwargs):
    "Initializes the badges"
    from biostar.forum.models import Badge
    from biostar.forum.awards import ALL_AWARDS
    from biostar.accounts.models import Profile

    for obj in ALL_AWARDS:
        badge = Badge.objects.filter(name=obj.name)
        if badge:
            continue
        name = slugify(obj.name)
        badge = Badge.objects.create(name=obj.name, uid=name)

        # Badge descriptions may change.
        if badge.desc != obj.desc:
            badge.desc = obj.desc
            badge.icon = obj.icon
            badge.type = obj.type
            badge.save()

        logger.debug("initializing badge %s" % badge)
def init_awards ( sender , * * kwargs ) : from biostar . forum . models import Badge from biostar . forum . awards import ALL_AWARDS from biostar . accounts . models import Profile for obj in ALL_AWARDS : badge = Badge . objects . filter ( name = obj . name ) if badge : continue name = slugify ( obj . name ) badge = Badge . objects . create ( name = obj . name , uid = name ) # Badge descriptions may change. if badge . desc != obj . desc : badge . desc = obj . desc badge . icon = obj . icon badge . type = obj . type badge . save ( ) logger . debug ( "initializing badge %s" % badge )