def question(): if not is_admin(): return 'login_fail' question_id = request.form['question_id'] question = model.get_question(question_id) topic_id = question['topic_id'] action = request.form['action'] if action == 'delete': model.delete_question(question_id) return redirect('/admin/questions?topic_id=%(id)s' % {'id': topic_id})
def question(): if not is_admin(): return "login_fail" question_id = request.form["question_id"] question = model.get_question(question_id) topic_id = question["topic_id"] action = request.form["action"] if action == "delete": model.delete_question(question_id) return redirect("/admin/questions?topic_id=%(id)s" % {"id": topic_id})
def GET(self): i = web.input() question_id = i["question_id"] print "question id is", question_id question = model.get_question(question_id) print "Question is", question topic_id = question["topic_id"] action = i.action if action == "delete": model.delete_question(question_id) raise web.seeother("questions?topic_id=%(id)s" % {"id": topic_id})
def POST(self): '''Deletes selected questions and returns to the admin page.''' question_ids = web.input() for id in question_ids: model.delete_question(id) raise web.seeother('/')