Project Challenge: For Loop in Jinja

In this lesson, we will be solving a challenge related to the usage of for-loops in Jinja.

Problem statement

In a real-world application, we want our data to be dynamic. So, even if the information changes, then the template also updates to reflect the updated data.

Therefore, in this lesson, we will be rendering the data present in the application onto the templates. You are provided a list of dictionaries, called pets, containing the information regarding some pets. In this model, each dictionary is one pet. All you have to do is to render this data in the form of a table using a for loop in the home.html template.

📌 Note: The id of a pet coincides with the name of the corresponding image file.

Before you get started, please take a look at the documentation of filters in Jinja.

Get hands-on with 1400+ tech skills courses.