Exemple #1
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)
Exemple #2
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")