diff --git a/advlabdb/customClasses.py b/advlabdb/customClasses.py index 3f4ceb7..36c5917 100644 --- a/advlabdb/customClasses.py +++ b/advlabdb/customClasses.py @@ -134,12 +134,11 @@ class CustomModelView(ModelView): model = self.customCreateModel(form) self.session.add(model) - self.on_model_change(form, model, True) - self.session.commit() except Exception as ex: - flash(str(ex), "error") + if not self.handle_view_exception(ex): + flash(str(ex), "error") self.session.rollback() else: