Beispiel #1
0
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})
Beispiel #2
0
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})
Beispiel #3
0
 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})
Beispiel #4
0
 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('/')
Beispiel #5
0
 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('/')