Writing the Code for the Models

Writing the code for the model and rerun the test.

In this lesson, we write the simplest code that will make the test run successfully and also discuss refactoring. This means we combine the remaining three steps involved in TDD in this lesson.

The Catalogue model

Here’s the complete model showing the continuation of the project for this course:

The model for the catalog with the necessary fields

After writing the model, the next step is to sync the data to the database by running the makemigrations and migrate commands. We have already done this for you.

Let’s discuss the model above.

Let’s discuss the model above.

Lines 5–8 ...