def show_admin_all_polls(): entries = Poll.get_all().fetch(10) for entry in entries: entry.answers = PollAnswer.query(PollAnswer.parent == entry.key) if entry.type == "poll": entry.yes = PollAnswer.query(PollAnswer.parent == entry.key, PollAnswer.answer == "yes").count() entry.no = PollAnswer.query(PollAnswer.parent == entry.key, PollAnswer.answer == "no").count() config = app.config.get('config') jsonconfig = json.dumps(app.config.get('config')) return render_template('admin/all_polls.html', appconfig=config, config=jsonconfig, entries=entries)
def show_admin_all_polls(): entries = Poll.get_all().fetch(10) for entry in entries: entry.answers = PollAnswer.query(PollAnswer.parent == entry.key) for answer in entry.answers: answer.student = getStudent(answer.studentId) answer.studentName = getStudentName(answer.student) if entry.type == "poll": entry.yes = PollAnswer.query(PollAnswer.parent == entry.key, PollAnswer.answer == "yes").count() entry.no = PollAnswer.query(PollAnswer.parent == entry.key, PollAnswer.answer == "no").count() jsonconfig = json.dumps(app.config.get('config')) return render_template('admin/all_polls.html', jsconfig=jsonconfig, entries=entries)