Add a message if there are no quotes.
This commit is contained in:
parent
245377b17a
commit
90d9b7fcb0
1 changed files with 15 additions and 8 deletions
|
@ -66,15 +66,22 @@ def latest():
|
||||||
def queue():
|
def queue():
|
||||||
quotes = Quote.query.filter_by(approved=False).order_by(Quote.id).all()
|
quotes = Quote.query.filter_by(approved=False).order_by(Quote.id).all()
|
||||||
|
|
||||||
# Replace line breaks with html breaks and escape special characters
|
if len(quotes)>0:
|
||||||
for quote in quotes:
|
# Replace line breaks with html breaks and escape special characters
|
||||||
quote.content = str(Markup.escape(quote.content)).replace('\n', '</br>')
|
for quote in quotes:
|
||||||
|
quote.content = str(Markup.escape(quote.content)).replace('\n', '</br>')
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"queue.html",
|
"queue.html",
|
||||||
title="Queue",
|
title="Queue",
|
||||||
quotes=quotes
|
quotes=quotes
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
return render_template(
|
||||||
|
"message.html",
|
||||||
|
alertclass="alert-warning",
|
||||||
|
message="No quotes in the database. "
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/quote/<int:id>')
|
@app.route('/quote/<int:id>')
|
||||||
|
|
Loading…
Add table
Reference in a new issue