In our scenario, we build the loan document after collecting information from the potential borrower using a Django form. Here is the code, located in /path/to/repo/www/chapter_10/loan/views.py. At the beginning of the code file are the import statements:
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.common import CommonService
from biglittle.domain.loan import LoanService
from biglittle.domain.user import UserService
from biglittle.entity.loan import Loan
from biglittle.entity.user import User
from utils.utils import Utils
The method that presents the form to the fictitious borrower is index(). We first initialize the important variables:
def index(request) :
defCurr = 'USD'
proposals = {}
have_any = False
principal = 0.00
numPayments = 0
currency = defCurr
config...