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

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