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))
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))
def delete(self, id): question = self.question_q.filter_by(id = id).first() Session.delete(question) Session.commit() redirect(url(controller='questions', action='index'))
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))
def __before__(self): self.question_q = Session.query(Question)