@login_required
def delete(request, id):
    """
    Delete the specified article.
    """
    article = get_object_or_404(Article, pk=id, author=request.user, status=Article.DRAFT)
    if request.method == 'POST':
        form = DeleteArticleForm(data=request.POST)
        if form.is_valid():
            article.delete()
            messages.info(request, "The article was successfully deleted.")
            return redirect(request.user.profile)
    else:
        form = DeleteArticleForm()
    return render(request, 'form.html', {
        'title': 'Delete "%s"' % article,
        'parent': {
            'title': article,
            'url': article.get_absolute_url(),
        },
        'description': "Are you sure you want to delete this article? This action cannot easily be undone.",
        'form': form,
        'action': 'Delete',
    })
dataset/ETHPy150Open 2buntu/2buntu-blog/twobuntu/articles/views.py/delete/original