@treeio_login_required
@handle_response_format
def tax_edit(request, tax_id, response_format='html'):
 tax = get_object_or_404(Tax, pk=tax_id)
 if ((not request.user.profile.has_permission(tax, mode='w')) and (not request.user.profile.is_admin('treeio_finance'))):
  return user_denied(request, "You don't have access to this Tax", response_format)
 if request.POST:
  if ('cancel' not in request.POST):
   form = TaxForm(request.user.profile, request.POST, instance=tax)
   if form.is_valid():
    tax = form.save()
    return HttpResponseRedirect(reverse('finance_tax_view', args=[tax.id]))
  else:
   return HttpResponseRedirect(reverse('finance_tax_view', args=[tax.id]))
 else:
  form = TaxForm(request.user.profile, instance=tax)
 return render_to_response('finance/tax_edit', {'form': form, 'tax': tax}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required @ handle_response_format def tax_edit ( request , tax_id , response_format = 'html' ) : tax = get_object_or_404 ( Tax , pk = tax_id ) if ( ( not request . user . profile . has_permission ( tax , mode = 'w' ) ) and ( not request . user . profile . is_admin ( 'treeio_finance' ) ) ) : return user_denied ( request , "You don't have access to this Tax" , response_format ) if request . POST : if ( 'cancel' not in request . POST ) : form = TaxForm ( request . user . profile , request . POST , instance = tax ) if form . is_valid ( ) : tax = form . save ( ) return HttpResponseRedirect ( reverse ( 'finance_tax_view' , args = [ tax . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'finance_tax_view' , args = [ tax . id ] ) ) else : form = TaxForm ( request . user . profile , instance = tax ) return render_to_response ( 'finance/tax_edit' , { 'form' : form , 'tax' : tax } , context_instance = RequestContext ( request ) , response_format = response_format )
tax edit .