We need a way to upload loan documents, so we add a file upload HTML element to the maintenance.html template. We also add a loop that displays the currently uploaded documents for this borrower:
<tr><th class="th-right">Loan Documents Stored</th>
<td class="td-left">
{% for name in loan_docs %} <br>{{ name }} {% endfor %}
</td>
</tr>
<tr>
<th class="th-right">Upload Loan Document</th>
<td class="td-left"><input type="file" name="loan_doc" /></td>
</tr>
In the view logic (/path/to/repo/www/chapter_10/maintenance/views.py), we add the following to the payments() method. If there is a borrowerKey value available, we import GridFS and os, and retrieve borrower information (discussed earlier):
if borrowerKey :
from gridfs import GridFS
import os
borrower = userSvc...