@treeio_login_required
@handle_response_format
def currency_edit(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')) and (not request.user.profile.is_admin('treeio_finance'))):
  return user_denied(request, "You don't have access to this Currency", response_format)
 if request.POST:
  if ('cancel' not in request.POST):
   form = CurrencyForm(request.user.profile, request.POST, instance=currency)
   if form.is_valid():
    currency = form.save()
    return HttpResponseRedirect(reverse('finance_currency_view', args=[currency.id]))
  else:
   return HttpResponseRedirect(reverse('finance_currency_view', args=[currency.id]))
 else:
  form = CurrencyForm(request.user.profile, instance=currency)
 return render_to_response('finance/currency_edit', {'form': form, 'currency': currency}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def currency_edit ( 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' ) ) and ( not request . user . profile . is_admin ( 'treeio_finance' ) ) ) : return user_denied ( request , "You don't have access to this Currency" , response_format ) if request . POST : if ( 'cancel' not in request . POST ) : form = CurrencyForm ( request . user . profile , request . POST , instance = currency ) if form . is_valid ( ) : currency = form . save ( ) return HttpResponseRedirect ( reverse ( 'finance_currency_view' , args = [ currency . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'finance_currency_view' , args = [ currency . id ] ) ) else : form = CurrencyForm ( request . user . profile , instance = currency ) return render_to_response ( 'finance/currency_edit' , { 'form' : form , 'currency' : currency } , context_instance = RequestContext ( request ) , response_format = response_format )
currency edit .