def course(course): """Redirects to a random question for a chosen course""" models.Course.query.filter_by(code=course).first_or_404() return redirect( url_for('quiz.question_course', course_code=course, id=utils.random_id(course=course)))
def get(self, course_code, exam_name=None): current = request.args.get('id', -1) try: current = int(current) except ValueError: current = -1 return {'index': utils.random_id(id=current, course=course_code, exam=exam_name)}
def get(self, course_code, exam_name=None): current = request.args.get('id', -1) try: current = int(current) except: current = -1 return { 'index': utils.random_id(id=current, course=course_code, exam=exam_name) }
def context(self, *args, **kwargs): context = super().context(*args, **kwargs) random_question = utils.random_id(id=id, course=self.model.course.code) reset_url = url_for('quiz.reset_stats_exam', course=self.model.course.code, exam=self.model.name) context.update({ 'exam_name': self.model.name, 'reset_url': reset_url, 'random': random_question }) return context
def context(self, *args, **kwargs): context = super().context(*args, **kwargs) reset_url = url_for('quiz.reset_stats_course', course=self.model.code) random_question = utils.random_id(id=id, course=self.model.code) context.update({ 'exam_name': 'all', 'reset_url': reset_url, 'random': random_question }) return context
def course(course): """Redirects to a random question for a chosen course""" models.Course.query.filter_by(code=course).first_or_404() return redirect(url_for( 'quiz.question_course', course_code=course, id=utils.random_id(course=course)) )