Fixed bug where deleted quotes would sometimes be picked for random quote
This commit is contained in:
parent
0211771bfd
commit
b51a0e9769
1 changed files with 1 additions and 2 deletions
|
@ -42,8 +42,7 @@ def index():
|
||||||
quotes = Quote.query.filter_by(approved=True).order_by(Quote.id.desc())all()
|
quotes = Quote.query.filter_by(approved=True).order_by(Quote.id.desc())all()
|
||||||
numOfQuotes = len(quotes)
|
numOfQuotes = len(quotes)
|
||||||
if len(quotes)>0:
|
if len(quotes)>0:
|
||||||
quoteNum = random.choice(range(1,numOfQuotes+1))
|
quote = random.choice(quotes)
|
||||||
quote = quotes[quoteNum]
|
|
||||||
news = str(Markup.escape(quote.content)).replace('\n', '<br />')
|
news = str(Markup.escape(quote.content)).replace('\n', '<br />')
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
|
|
Loading…
Add table
Reference in a new issue