Project Challenge: Inserting Pets

In this challenge, we will insert some pets in the system by default and retrieve them to show on the home page.

We'll cover the following

Problem statement

In the previous challenges, we got rid of the users list. Now, we also want to replace the pets list. Therefore, in this challenge, you will perform the following tasks:

  1. Create objects of the Pet model corresponding to the dictionaries that are present in the pets list.

  2. Add these objects to the db.session and commit them to the database.

  3. Handle any exceptions while committing.

  4. You can implement this below the insertion of the team object of the User model.

📌 Note: you do not have to add the value of the posted_by column of the pets.

Get hands-on with 1200+ tech skills courses.