コード例 #1
0
ファイル: models.py プロジェクト: 20twoes/hackerunion.org
def create_lists(sender, instance, created, **kwargs):
    if created:
        from petri.mail.utils import create_chapter_lists
        from petri.mail.utils import create_chapter_routes

        create_chapter_lists(instance)
        create_chapter_routes(instance)
コード例 #2
0
def chapter_post_save(sender, instance, created, **kwargs):
    if created:
        from petri.mail.utils import create_chapter_lists
        from petri.mail.utils import create_chapter_routes

        create_chapter_lists(instance)
        create_chapter_routes(instance)

    # update the scss file to update the chapter colors.
    if instance.base_color:
        with open(settings.CHAPTER_SCSS_DIR + instance.slug + ".scss", 'r+') as f:
            data = f.read()
            data = re.sub(r'\$primary-color:[^;]*', '$primary-color:' + instance.base_color, data)
            f.seek(0)
            f.write(data)
            f.truncate()