def accept_text(id): text = Text.get(Text.id == id) try: accepted = request.values['accepted'].lower() == "true" except KeyError: accepted = False text.accepted = accepted text.save() return redirect_back(url_for('cell', id=text.source.id))
def update(self, pk): try: text = Text.get(Text.id == pk) except Text.DoesNotExist: text = Text() source = SplitFile.get(SplitFile.id == self.data['source']) text.source = source text.text = self.data['text'] text.accepted = self.data['accepted'] text.save() return text