@treeio_login_required
@handle_response_format
def category_delete(request, category_id, response_format='html'):
 category = get_object_or_404(Category, pk=category_id)
 if (not request.user.profile.has_permission(category, mode='w')):
  return user_denied(request, "You don't have access to this Category", response_format)
 if request.POST:
  if ('delete' in request.POST):
   if ('trash' in request.POST):
    category.trash = True
    category.save()
   else:
    category.delete()
   return HttpResponseRedirect(reverse('finance_settings_view'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('finance_category_view', args=[category.id]))
 return render_to_response('finance/category_delete', {'category': category}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def category_delete ( request , category_id , response_format = 'html' ) : category = get_object_or_404 ( Category , pk = category_id ) if ( not request . user . profile . has_permission ( category , mode = 'w' ) ) : return user_denied ( request , "You don't have access to this Category" , response_format ) if request . POST : if ( 'delete' in request . POST ) : if ( 'trash' in request . POST ) : category . trash = True category . save ( ) else : category . delete ( ) return HttpResponseRedirect ( reverse ( 'finance_settings_view' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'finance_category_view' , args = [ category . id ] ) ) return render_to_response ( 'finance/category_delete' , { 'category' : category } , context_instance = RequestContext ( request ) , response_format = response_format )
knowledge category delete .