The view logic for this illustration is found in /path/to/repo/www/chapter_10/maintenance/views.py. As with other classes, we first import the necessary Python and Django classes. In addition, we import the necessary BigLittle entity and domain service classes:
from django.template.loader import render_to_string
from django.http import HttpResponse
from config.config import Config
from db.mongodb.connection import Connection
from biglittle.domain.user import UserService
from biglittle.domain.loan import LoanService
from biglittle.entity.loan import Loan,LoanInfo,Payment
from biglittle.entity.user import User
In the index() method, the loan admin chooses the borrower whose payment is processed. We first initialize key variables:
def index(request) :
loan = Loan()
amtPaid = 0.00
amtDue = 0.00
message = ''
borrower = None
borrowerKey = None
borrowerName = ''
payments = ...