示例#1
0
def article_create(title, author, is_page=False):
    pile = Pile(name="article", is_standalone=False)
    pile.save()
    article = Article(title=title, author=author, pile=pile, is_page=is_page) or None
    article.save()
    pile.name = "article-%d" % article.id
    pile.save()
    scrap = scraps_utils.scrap_create("text-wysiwyg")
    scraps_utils.scrap_repile(scrap.id, pile.id)
    scraps_utils.scrap_toggle(scrap.id, True)
    return article
示例#2
0
def article_scrap_create(request, article_id, is_page=False):
    if request.method == 'POST':
        article = utils.article_get(article_id)
        create_scrap_form = CreateScrapForm(request.POST)
        if create_scrap_form.is_valid():
            blueprint_name = create_scrap_form.cleaned_data['blueprint_name']
            scrap = scraps_utils.scrap_create(blueprint_name)
            scraps_utils.scrap_repile(scrap.id, article.pile.id)
    if is_page:
        return redirect('articles_admin_page_edit', article_id=article_id)
    else:
        return redirect('articles_admin_article_edit', article_id=article_id)
示例#3
0
def scrap_repile(request, scrap_id, pile_id=None):
    utils.scrap_repile(scrap_id, pile_id)
    if request.is_ajax():
        return utils.asyncAllPilesRefresh()
    return redirect("scraps_admin_manage")