@handle_response_format
@treeio_login_required
def item_delete(request, knowledgeItem_id, response_format='html'):
 item = get_object_or_404(KnowledgeItem, pk=knowledgeItem_id)
 items = Object.filter_permitted(manager=KnowledgeItem.objects, user=request.user.profile, mode='r')
 if (not request.user.profile.has_permission(item, mode='w')):
  return user_denied(request, message="You don't have access to this Knowledge Item")
 if request.POST:
  if ('delete' in request.POST):
   if ('trash' in request.POST):
    item.trash = True
    item.save()
   else:
    item.delete()
   return HttpResponseRedirect(reverse('knowledge_index'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('knowledge_item_view', args=[item.folder.treepath, item.treepath]))
 context = _get_default_context(request)
 context.update({'item': item, 'items': items})
 return render_to_response('knowledge/item_delete', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def item_delete ( request , knowledgeItem_id , response_format = 'html' ) : item = get_object_or_404 ( KnowledgeItem , pk = knowledgeItem_id ) items = Object . filter_permitted ( manager = KnowledgeItem . objects , user = request . user . profile , mode = 'r' ) if ( not request . user . profile . has_permission ( item , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Knowledge Item" ) if request . POST : if ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : item . trash = True item . save ( ) else : item . delete ( ) return HttpResponseRedirect ( reverse ( 'knowledge_index' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'knowledge_item_view' , args = [ item . folder . treepath , item . treepath ] ) ) context = _get_default_context ( request ) context . update ( { 'item' : item , 'items' : items } ) return render_to_response ( 'knowledge/item_delete' , context , context_instance = RequestContext ( request ) , response_format = response_format )
item delete .