Within the Django property app, let's turn our attention to views.py. At the top of the module, the classes we need are imported:
from django.http import HttpResponse, HttpResponseRedirect
from django.template.loader import render_to_string
from .forms import FormService, PropertyForm, NameForm,
PropInfoForm, LocationForm, ContactForm, RoomTypeForm
import os,sys
from config.config import Config
from booksomeplace.entity.base import Base, Name, Location, Contact
from booksomeplace.entity.property import Property, PropInfo, RoomType
from booksomeplace.domain.property import PropertyService
The addEdit() method uses the same set of forms for either adding a new room or updating an existing one. The first thing we need to do in this method is to retrieve an instance of the property and form services:
def addEdit(request, prop_key = None) :
prop_name = 'NEW'
add_or_edit = 'ADD'
mainConfig = Config()
...