Skip to content Skip to sidebar Skip to footer

Looping Over A List In A Jinja2 Template

Im trying to make a simple blog website with the Flask framework. Each entry in my blog has a title, text and comments. the title and text are stored in a table named entries and t

Solution 1:

You haven't really told us what your problem is so I don't know if this will help. But I'll point out three specific mistakes here:

The first is that you're putting your comments in an unordered list (the <ul> tag) but you put the end tag (</ul>) inside the loop instead of outside it.

</br> should be written <br />, but really that tag doesn't belong there in the first place.

Second, your HTML is broken. HTML attributes (the parts in tags like type=submit) should have quotation marks around the values. For example, it should look like type="submit". Most browsers are forgiving when it comes to things like that, but it's better not to count on that and write correct HTML.


Post a Comment for "Looping Over A List In A Jinja2 Template"