def index(): #gets a list of all quotes found, and selected a random one# quotes_list = Quote.GetQuotes() random_quote = quotes_list[random.randint(0, len(quotes_list) - 1)] #returns the standard view with the random quote as data# return render_template(pagenames["random"], quote=random_quote)
def specificQuote(id): quotes_list = Quote.GetQuotes() #loop through all the quotes that have been found# for quote in quotes_list: #bascially checks if the quote is the one with the parameter id# if quote.Id == id: #create a new quote object, and give it to the view# quote = Quote(quote.Quote, quote.Source, quote.Id) return render_template(pagenames["quote"], quote=quote) #when the parameter id is not being used, return to the list# return redirect(f'/quotes/')
def quotes(): #gets a list of all quotes, and return the list with the view# quotes_list = Quote.GetQuotes() return render_template(pagenames["list"], quotes=quotes_list)