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:
-
Create objects of the
Pet
model corresponding to the dictionaries that are present in thepets
list. -
Add these objects to the
db.session
and commit them to the database. -
Handle any exceptions while committing.
-
You can implement this below the insertion of the
team
object of theUser
model.
📌 Note: you do not have to add the value of the
posted_by
column of the pets.
Get hands-on with 1400+ tech skills courses.