Jun-28-2020, 05:40 PM
Hello guys.
I am using Flask for the web interface
I am having trouble rendering the template properly.
This is my code:
=================================================
<html>
<head>
<title>Announcements | My Dummy Company</title>
</head>
<body>
<center>
<h1>My Dummy Company</h1>
<h2>Announcements</h2>
</center>
{{ announcements }}
</body>
</html>
=================================================
The command
Everything until here works exactly as expected.
The problem shows up when the actual page is rendered.
Here is the part where the generated <a> tags need to go in:
Aren't they supposed to be rendered like normal <a> tags?
Is it that I have the generated HTML snippet in one line?
Please help me understand what went wrong.
Thanks in advance
I am using Flask for the web interface
I am having trouble rendering the template properly.
This is my code:
@app.route('/announcements') def announcements(): announcements = f_list() return flask.render_template('announcements.html', announcements=announcements)announcements.html:
=================================================
<html>
<head>
<title>Announcements | My Dummy Company</title>
</head>
<body>
<center>
<h1>My Dummy Company</h1>
<h2>Announcements</h2>
</center>
{{ announcements }}
</body>
</html>
=================================================
The command
f_list()
returns this value:<a href="/announcements/post?id=1510147646">My first post</a><br><a href="/announcements/id?post=1636152462">My announcement</a><br><a href="/announcements/id?post=2490566582">My third post</a><br><a href="/announcements/id?post=2682700533">Hi</a><br><a href="/announcements/id?post=2980593702">duio fgstbhguoh rtgb;fbhuio trhiojtribh tg</a><br><a href="/announcements/id?post=3732746396">my fourth post</a><br><a href="/announcements/id?post=5164710657">Hello World</a><br><a href="/announcements/id?post=5952756057">my sixth post</a><br><a href="/announcements/id?post=9651076261">my seventh post</a><br>
Everything until here works exactly as expected.
The problem shows up when the actual page is rendered.
Here is the part where the generated <a> tags need to go in:
Error:</center>
<a href="/announcements/post?id=1510147646">kldfhnibhkduhlbliufhbu;dnoibf</a><br><a href="/announcements/id?post=1636152462">My announcement</a><br><a href="/announcements/id?post=2490566582">duoisgfugfdg</a><br><a href="/announcements/id?post=2682700533">Hi</a><br><a href="/announcements/id?post=2980593702">duio fgstbhguoh rtgb;fbhuio trhiojtribh tg</a><br><a href="/announcements/id?post=3732746396">isfh;sgufhioghldfighdf;g</a><br><a href="/announcements/id?post=5164710657">Hello World</a><br><a href="/announcements/id?post=5952756057">idulfsgvkdfdbhguhfbndlhufib;ldfb</a><br><a href="/announcements/id?post=9651076261">ildgbkldjkbnldf hgibtgf</a><br>
</body>
Why do they render in this manner?Aren't they supposed to be rendered like normal <a> tags?
Is it that I have the generated HTML snippet in one line?
Please help me understand what went wrong.
Thanks in advance
