def random(): word = Entry.get_random() # Test if an entry was returned if word: word = word['slug'] return redirect(url_for('qchar', word=word)) else: return ""
def main(): samples = [] for i in range(3): e = Entry.objects.get(slug=Entry.get_random()['slug']) samples.append({'name': e.name, 'definition': e.get_hero()}) return render_template('main.html', letters=[x for x in uppercase], samples=samples)
def main(): samples = [] for i in range(3): e = Entry.objects.get(slug=Entry.get_random()['slug']) samples.append({'name': e.name, 'definition': e.get_hero()}) return render_template( 'main.html', letters=[x for x in uppercase], samples=samples )
def main(): """ Presents main Page With 3 random words on the front page if DB has more than 3 words. """ samples = [] for i in range(3): #e = Entry.objects.get(slug=Entry.get_random()['slug']) entry = Entry.get_random() if entry: samples.append({'name': entry.name, 'definition': entry.get_hero()}) return render_template( 'main.html', letters=[x for x in uppercase], samples=samples )
def random(): word = Entry.get_random()['slug'] return redirect(url_for('qchar', word=word))