Example #1
0
def suggestion_approve(question_id):
    question = cdw.suggestions.with_id(question_id)
    new_question = Question(category=question.category, text=question.text)
    new_question.save()
    question.delete()
    flash("Question approved", "info")
    return redirect("/admin/debates/suggestions")
Example #2
0
    def to_question(self):
        try:
            user = cdw.users.with_id(self.author.data)
        except:
            user = None

        return Question(category=cdw.categories.with_id(self.category.data),
                        author=user,
                        text=self.text.data)