def delete(self, id): """delete item with id """ item = self.item_q.filter_by(id=id).first() if not item: flash('Item with id %s not found' % id) Session.delete(item) Session.commit() flash('Deleted %s!' % item.headline) redirect_to('unread_items')
def save(self, id): """save item with id """ item = self.item_q.filter_by(id=id).first() if not item: item = Item(request.params['headline'], request.params['url']) item.desc="dummy desc" Session.add(item) Session.commit() flash('Successfully saved %s!' % item.headline) redirect_to('unread_items')