@handle_response_format
@treeio_login_required
def equity_add(request, response_format='html'):
 equities = Object.filter_by_request(request, Equity.objects, mode='r')
 if request.POST:
  if ('cancel' not in request.POST):
   equity = Equity()
   form = EquityForm(request.user.profile, request.POST, instance=equity)
   if form.is_valid():
    equity = form.save()
    equity.set_user_from_request(request)
    return HttpResponseRedirect(reverse('finance_equity_view', args=[equity.id]))
  else:
   return HttpResponseRedirect(reverse('finance_index_equities'))
 else:
  form = EquityForm(request.user.profile)
 return render_to_response('finance/equity_add', {'form': form, 'equities': equities}, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def equity_add ( request , response_format = 'html' ) : equities = Object . filter_by_request ( request , Equity . objects , mode = 'r' ) if request . POST : if ( 'cancel' not in request . POST ) : equity = Equity ( ) form = EquityForm ( request . user . profile , request . POST , instance = equity ) if form . is_valid ( ) : equity = form . save ( ) equity . set_user_from_request ( request ) return HttpResponseRedirect ( reverse ( 'finance_equity_view' , args = [ equity . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'finance_index_equities' ) ) else : form = EquityForm ( request . user . profile ) return render_to_response ( 'finance/equity_add' , { 'form' : form , 'equities' : equities } , context_instance = RequestContext ( request ) , response_format = response_format )
new equity form .