コード例 #1
0
ファイル: questions.py プロジェクト: jessSchn/breakfast
 def create(self):
     question = Question()
     question.question = request.params["question"]
     question.break_script = request.params["break_script"]
     question.author_id = 1 # TODO Remove this ASAP
     Session.add(question)
     Session.commit()
     redirect(url(controller='questions', action='show', id = question.id))
コード例 #2
0
ファイル: questions.py プロジェクト: jessSchn/breakfast
 def down(self, id):
     question = self.question_q.filter_by(id = id).first()
     question.vote_down()
     Session.commit()
     redirect(url(controller='questions', action='show', id = question.id))
コード例 #3
0
ファイル: questions.py プロジェクト: jessSchn/breakfast
 def delete(self, id):
     question = self.question_q.filter_by(id = id).first()
     Session.delete(question)
     Session.commit()
     redirect(url(controller='questions', action='index'))
コード例 #4
0
ファイル: questions.py プロジェクト: jessSchn/breakfast
 def update(self, id):
     question = self.question_q.filter_by(id = id).first()
     question.question = request.params["question"]
     Session.commit()
     redirect(url(controller='questions', action='show', id = question.id))
コード例 #5
0
ファイル: questions.py プロジェクト: jessSchn/breakfast
 def __before__(self):
     self.question_q = Session.query(Question)