@handle_response_format
@treeio_login_required
def folder_delete(request, folder_id, response_format='html'):
 folder = get_object_or_404(Folder, pk=folder_id)
 if (not request.user.profile.has_permission(folder, mode='w')):
  return user_denied(request, message="You don't have access to this Folder")
 if request.POST:
  if ('delete' in request.POST):
   if ('trash' in request.POST):
    folder.trash = True
    folder.save()
   else:
    folder.delete()
   return HttpResponseRedirect(reverse('document_index'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('documents_folder_view', args=[folder.id]))
 query = ((Q(object_type='treeio.documents.models.Document') | Q(object_type='treeio.documents.models.File')) | Q(object_type='treeio.documents.models.WebLink'))
 query = (query & ((Q(document__folder=folder) | Q(file__folder=folder)) | Q(weblink__folder=folder)))
 if request.GET:
  query = _get_filter_query(request.GET)
  objects = Object.filter_by_request(request, Object.objects.filter(query))
 else:
  objects = Object.filter_by_request(request, Object.objects.filter(query))
 context = _get_default_context(request)
 context.update({'folder': folder, 'objects': objects})
 return render_to_response('documents/folder_delete', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def folder_delete ( request , folder_id , response_format = 'html' ) : folder = get_object_or_404 ( Folder , pk = folder_id ) if ( not request . user . profile . has_permission ( folder , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Folder" ) if request . POST : if ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : folder . trash = True folder . save ( ) else : folder . delete ( ) return HttpResponseRedirect ( reverse ( 'document_index' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'documents_folder_view' , args = [ folder . id ] ) ) query = ( ( Q ( object_type = 'treeio.documents.models.Document' ) | Q ( object_type = 'treeio.documents.models.File' ) ) | Q ( object_type = 'treeio.documents.models.WebLink' ) ) query = ( query & ( ( Q ( document__folder = folder ) | Q ( file__folder = folder ) ) | Q ( weblink__folder = folder ) ) ) if request . GET : query = _get_filter_query ( request . GET ) objects = Object . filter_by_request ( request , Object . objects . filter ( query ) ) else : objects = Object . filter_by_request ( request , Object . objects . filter ( query ) ) context = _get_default_context ( request ) context . update ( { 'folder' : folder , 'objects' : objects } ) return render_to_response ( 'documents/folder_delete' , context , context_instance = RequestContext ( request ) , response_format = response_format )
type delete .