Once a loan proposal has been accepted by the borrower, we are able to put together a Loan document. This is where we put document references to use. The code that captures the borrower's selection is also located in views.py, in the accept() method. We start by checking to see if the request is an HTTP POST. We also check to make sure the accept button was pressed, and that the key for lender was included in the post, shown here:
def accept(request) :
message = 'Sorry! Unable to process your loan request'
utils = Utils()
if request.method == 'POST':
if 'accept' in request.POST :
if 'lender' in request.POST :
lenderKey = request.POST['lender']
borrowerKey = request.POST['borrower']
We retrieve the proposals from our simple cache class and loop through them until we match the lender key, after which we use the loan...