Example #1
0
def scrap_create(request, blueprint_name=None):
    if blueprint_name:
        scrap = utils.scrap_create(blueprint_name)
    else:
        if request.method == "POST":
            create_scrap_form = CreateScrapForm(request.POST)
            if create_scrap_form.is_valid():
                blueprint_name = create_scrap_form.cleaned_data["blueprint_name"]
                scrap = utils.scrap_create(blueprint_name)
                if request.is_ajax():
                    return utils.asyncPileBodyRefresh(scrap.id)
    return redirect("scraps_admin_manage")
Example #2
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
Example #3
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)