@handle_response_format
@treeio_login_required
def receivable_add(request, response_format='html'):
 if request.POST:
  if ('cancel' not in request.POST):
   receivable = Liability()
   form = ReceivableForm(request.user.profile, request.POST, instance=receivable)
   if form.is_valid():
    receivable = form.save(commit=False)
    receivable.target = receivable.account.owner
    convert(receivable, 'value')
    receivable.set_user_from_request(request)
    return HttpResponseRedirect(reverse('finance_receivable_view', args=[receivable.id]))
  else:
   return HttpResponseRedirect(reverse('finance_index_receivables'))
 else:
  form = ReceivableForm(request.user.profile)
 return render_to_response('finance/receivable_add', {'form': form}, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def receivable_add ( request , response_format = 'html' ) : if request . POST : if ( 'cancel' not in request . POST ) : receivable = Liability ( ) form = ReceivableForm ( request . user . profile , request . POST , instance = receivable ) if form . is_valid ( ) : receivable = form . save ( commit = False ) receivable . target = receivable . account . owner convert ( receivable , 'value' ) receivable . set_user_from_request ( request ) return HttpResponseRedirect ( reverse ( 'finance_receivable_view' , args = [ receivable . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'finance_index_receivables' ) ) else : form = ReceivableForm ( request . user . profile ) return render_to_response ( 'finance/receivable_add' , { 'form' : form } , context_instance = RequestContext ( request ) , response_format = response_format )
new receivable form .