Hi @david.bador,
Link to project: Introduction to Flask: Adopt a Pet
What is the purpose of this decorator?:
@app.route('/<html>'))
See the following version of the function, which is preceded by a route decorator that is the same as your first one :
@app.route("/animals/<pet_type>")
def animals(pet_type):
html = f"<h1>List of {pet_type}</h1>"
html += "<ul>"
for idx, item in enumerate(pets[pet_type]):
html += "<li>" + f'<a href="/animals/{pet_type}/{idx}">' + item["name"] + "</a></li>"
html += "</ul>"
return html
The following was edited on July 20, 2020 to explain that the above code includes some details that were added later than task 12.:
Some of the features within the code listed above, such as providing links to individual profile pages for each pet, were added after task 12. The links were created during task 16.
The function begins by establishing an <h1>
header. Thereafter, it initiates an unordered list with a <ul>
tag. Then, inside the loop, it populates the unordered list with list items that contain links. Finally, it places a closing </ul>
tag at the end of the list, and return
s the resulting markup for the page.