parameters: (request)
return_statement: return JsonResponse({
          'status': 'ok',
      }, encoder=JSONEncoder)
docstring: submit an income
docstring_summary: submit an income
docstring_tokens: submit an income
function: def submit_income(request):
      """ submit an income """
  
      # TODO: revise validation for the amount
      this_date = request.POST['date'] if 'date' in request.POST else timezone.now()
      this_text = request.POST['text'] if 'text' in request.POST else ""
      this_amount = request.POST['amount'] if 'amount' in request.POST else "0"
      this_token = request.POST['token'] if 'token' in request.POST else ""
      this_user = get_object_or_404(User, token__token=this_token)
  
      Income.objects.create(user=this_user, amount=this_amount,
                            text=this_text, date=this_date)
  
      return JsonResponse({
          'status': 'ok',
      }, encoder=JSONEncoder)
function_tokens: def submit_income ( request ) : # TODO: revise validation for the amount this_date = request . POST [ 'date' ] if 'date' in request . POST else timezone . now ( ) this_text = request . POST [ 'text' ] if 'text' in request . POST else "" this_amount = request . POST [ 'amount' ] if 'amount' in request . POST else "0" this_token = request . POST [ 'token' ] if 'token' in request . POST else "" this_user = get_object_or_404 ( User , token__token = this_token ) Income . objects . create ( user = this_user , amount = this_amount , text = this_text , date = this_date ) return JsonResponse ( { 'status' : 'ok' , } , encoder = JSONEncoder )