Adding models
Models define the data structures that will be used by our business applications. This recipe shows you how to add a basic model to a module. Models determine the logical structure of a database and how data is stored, organized, and manipulated. In other words, a model is a table of information that can be linked with other tables. A model usually represents a business concept, such as a sales order, contact, or product.
Modules contain various elements, such as models, views, data files, web controllers, and static web data.
To create a hostel module, we need to develop a model that represents the hostel.
Getting ready
We should have a module to work with. If you followed the first recipe in this chapter, Creating and installing a new add-on module, you will have an empty module called my_hostel
. We will use that for our explanation.
How to do it...
To add a new Model
, we need to add a Python file describing it and then upgrade the add-on module (or...