Esempio n. 1
0
    def delete_model(self, model):
        """Delete a record."""
        try:
            if model.json is None:
                return True
            record = Record(model.json, model=model)
            record.delete()
            db.session.commit()

        except SQLAlchemyError as e:
            if not self.handle_view_exception(e):
                flash('Failed to delete record. %s' % str(e), category='error')
            db.session.rollback()
            return False

        return True
Esempio n. 2
0
def delete_draft_record(record: Record):
    record.delete()