(sender, **kwargs)
Initialize the Biostar Herald Blog and Email Group.
Initialize the Biostar Herald Blog and Email Group.
Initialize the Biostar Herald Blog and Email Group .
def init_herald(sender, **kwargs):
    """
    Initialize the Biostar Herald Blog and Email Group.
    """
    from biostar.planet.models import Blog
    from django.shortcuts import reverse
    from biostar.emailer.models import EmailGroup

    title = "Biostar Herald"
    link = reverse('post_topic', kwargs=dict(topic='herald'))
    desc = "Share bioinformatics resources from across the web."

    uid = 'herald'

    hblog = Blog.objects.filter(link=link)
    group = EmailGroup.objects.filter(uid=uid)

    if hblog:
        hblog.update(desc=desc, title=title, remote=False)
    else:
        Blog.objects.create(title=title, desc=desc, remote=False, link=link)
        logger.info("created the biostar herald blog")

    if group:
        group.update(uid=uid, name=title, text=desc)
    else:
        EmailGroup.objects.create(uid=uid)
        logger.info("created the biostar herald email group")
def init_herald ( sender , * * kwargs ) : from biostar . planet . models import Blog from django . shortcuts import reverse from biostar . emailer . models import EmailGroup title = "Biostar Herald" link = reverse ( 'post_topic' , kwargs = dict ( topic = 'herald' ) ) desc = "Share bioinformatics resources from across the web." uid = 'herald' hblog = Blog . objects . filter ( link = link ) group = EmailGroup . objects . filter ( uid = uid ) if hblog : hblog . update ( desc = desc , title = title , remote = False ) else : Blog . objects . create ( title = title , desc = desc , remote = False , link = link ) logger . info ( "created the biostar herald blog" ) if group : group . update ( uid = uid , name = title , text = desc ) else : EmailGroup . objects . create ( uid = uid ) logger . info ( "created the biostar herald email group" )