In order to put all the pieces described in this sub-section together, we need the following:
- A view to render the sub-forms needed to collect contact information.
- View logic to capture and validate form post data.
- A template to incorporate the sub-forms and JavaScript functions.
- A domain service to update the properties collection.
A new view method, updateContact(), in /path/to/repo/www/chapter_08/property/views.py, creates instances of the form service described in the previous sub-section. In addition, it retrieves instances of both the partner and property domain services. The check variable represents the number of validation checks to be performed:
def updateContact(request) :
formSvc = FormService()
message = ''
config = Config()
partSvc = PartnerService(config)
propSvc = PropertyService(config)
check = 4
We then define a sequence of validation checks to be performed if the request method is POST...