def random_question(): if Question.random_id(): return redirect(url_for('question', id=Question.random_id())) else: flash('No questions found! Please create a new one.', 'negative') return new_question()