Commit 645fbbd2 authored by Jacob Magnusson's avatar Jacob Magnusson

Allow separate setting for whether to raise exception on integrity errors or not

parent 58e9ea7a
......@@ -1051,7 +1051,10 @@ class ModelView(BaseModelView):
# Error handler
def handle_view_exception(self, exc):
if isinstance(exc, IntegrityError):
if current_app.config.get('ADMIN_RAISE_ON_VIEW_EXCEPTION'):
if current_app.config.get(
'ADMIN_RAISE_ON_INTEGRITY_ERROR',
current_app.config.get('ADMIN_RAISE_ON_VIEW_EXCEPTION')
):
raise
else:
flash(gettext('Integrity error. %(message)s', message=text_type(exc)), 'error')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment