Creating new records
Creating new records is a regular requirement when putting business logic processes into practice. How you can build records for the hostel.room.category
model is included in this tutorial. We’ll add a function to the hostel.room.category
model to generate dummy categories for the purposes of our example. We will add the <form>
view to activate this approach.
Getting ready
You need to understand the structure of the models for which you want to create a record, especially their names and types, as well as any constraints that exist on these fields (for example, whether some of them are mandatory).
For this tutorial, we will reuse the my_hostel
module from Chapter 4, Application Models. Take a look at the following example to quickly recall the hostel.room.category
model:
class RoomCategory(models.Model): Â Â Â Â _name = 'hostel.room.category' Â Â Â Â _description = 'Hostel Room Category&apos...