We need a way to enter room types for a given property. This is seen in the /path/to/repo/www/chapter_08/property/views.py file. The addRoom() method looks for a URL parameter representing the property key. As you recall from the discussion in the earlier sub-section, after filling in the form for a new property, the Book Someplace admin is directed to this view.
The first logical block in this method verifies the incoming property key parameter. If it is present and correct, we use the PropertyService to perform a lookup, and retrieve a Property entity instance:
def addRoom(request, prop_key = None):
error_flag = True
prop_name = 'Unknown'
message = 'Please enter room information'
propService = PropertyService(Config())
if prop_key :
prop = propService.fetchByKey(prop_key)
if prop :
prop_name = prop.get('propName')
error_flag = False
...