Exemplo n.º 1
0
def delete_article(request,articleid):
    a = get_object_or_404(Article, aid=articleid)
    if request.user.username==a.authorname or in_editor_group(request.user):
        a.is_deleted=True
        a.save()
        return redirect(request,'/member/profile/%s/'%(a.authorname))#目前还没法在重定向的页面中提示删除成功,待完善
    else:
        return show_article(request,articleid,no_perm=True)
Exemplo n.º 2
0
def resume_article(request,articleid):
    '''可以与delete_article重构为同一个视图'''
    a = get_object_or_404(Article, aid=articleid)
    if in_admin_group(request.user):
        a.is_deleted=False
        a.save()
        return redirect(request,'/member/profile/%s/'%(a.authorname))
    else:
        raise Http404()