Finally, to present the view for bookings, we modify /path/to/repo/www/chapter_07/booking/view.py. In this file, we create an instance of the PropertyService class described previously. We then call the fetchTop10() method and pass the resulting MongoDB\Cursor instance to the template associated with this app:
from django.template.loader import render_to_string
from django.http import HttpResponse
from config.config import Config
from booksomeplace.domain.property import PropertyService
def index(request):
config = Config()
propService = PropertyService(config)
main = render_to_string('booking.html', { 'top_10' : propService.fetchTop10() })
page = render_to_string('layout.html', {'contents' : main})
return HttpResponse(page)
Now that you have an understanding of what goes into the view class, its time to have a look at the actual view template.