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

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