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

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