add news to index.html

This commit is contained in:
KF7EEL 2021-08-02 12:29:12 -07:00
parent 2f2053a236
commit 2d23f9521f
2 changed files with 31 additions and 1 deletions

View File

@ -599,7 +599,22 @@ def create_app():
@app.route('/')
def home_page():
#content = Markup('<strong>Index</strong>')
return render_template('index.html') #, markup_content = content)
l_news = News.query.order_by(News.time.desc()).first()
content = '''
<table style="width: 600px; margin-left: auto; margin-right: auto;" border="1" cellpadding="5">
<tr>
<td style="text-align: center;">
<h3>''' + l_news.subject + '''</h3>
</td>
</tr>
<tr>
<td style="text-align: center;"><strong>''' + l_news.date + '''</strong></td>
</tr>
<tr>
<td><br />''' + l_news.text + '''<br /><br /></td>
</tr>
</tbody></table>'''
return render_template('index.html', news = Markup(content))
@app.route('/help')
def help_page():

View File

@ -1,4 +1,19 @@
{% extends 'flask_user/_public_base.html' %}
{% block content %}
<p>&nbsp;</p>
<p>Welcome to the <strong>{{ user_manager.USER_APP_NAME }}</strong>. This tool is used to manage your access.</p>
<p>&nbsp;</p>
<table style="width: 600px; margin-left: auto; margin-right: auto;" border="1">
<tbody>
<tr>
<td style="text-align: center;">
<h4>Latest News:</h4>
{{news}}
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
{% endblock %}