@handle_response_format
@treeio_login_required
def liability_add(request, response_format='html'):
 liabilities = Object.filter_by_request(request, Liability.objects, mode='r')
 if request.POST:
  if ('cancel' not in request.POST):
   liability = Liability()
   form = LiabilityForm(request.user.profile, request.POST, instance=liability)
   if form.is_valid():
    liability = form.save(commit=False)
    liability.source = liability.account.owner
    convert(liability, 'value')
    liability.set_user_from_request(request)
    return HttpResponseRedirect(reverse('finance_liability_view', args=[liability.id]))
  else:
   return HttpResponseRedirect(reverse('finance_index_liabilities'))
 else:
  form = LiabilityForm(request.user.profile)
 return render_to_response('finance/liability_add', {'form': form, 'liabilities': liabilities}, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def liability_add ( request , response_format = 'html' ) : liabilities = Object . filter_by_request ( request , Liability . objects , mode = 'r' ) if request . POST : if ( 'cancel' not in request . POST ) : liability = Liability ( ) form = LiabilityForm ( request . user . profile , request . POST , instance = liability ) if form . is_valid ( ) : liability = form . save ( commit = False ) liability . source = liability . account . owner convert ( liability , 'value' ) liability . set_user_from_request ( request ) return HttpResponseRedirect ( reverse ( 'finance_liability_view' , args = [ liability . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'finance_index_liabilities' ) ) else : form = LiabilityForm ( request . user . profile ) return render_to_response ( 'finance/liability_add' , { 'form' : form , 'liabilities' : liabilities } , context_instance = RequestContext ( request ) , response_format = response_format )
new liability form .