Creating a Recipe Model
As you can imagine, a recipe may have several attributes. To save every detail of these attributes, we will model the recipe using a class. This recipe class is going to have several essential attributes.
Here is a brief description of the attributes that we will define in the recipe class:
name: The name of the recipe.
description: The description of the recipe.
num_of_servings: The number of servings.
cook_time: The cooking time required. This is an integer whose units are in seconds.
directions: The directions.
is_publish: The publish status of the recipe; the default is draft.
In the next exercise, we will show you how to code the recipe class so that it has these attributes.
Exercise 6: Creating the Recipe Model
In this exercise, we will code the recipe model, step by step. The
recipe class will contain the attributes that we discussed previously. The code file for this exercise can be found in