mirror of
https://github.com/apache/superset.git
synced 2026-06-05 15:49:27 +00:00
21 lines
668 B
Python
21 lines
668 B
Python
# -*- coding: utf-8 -*-
|
|
# pylint: disable=C,R,W
|
|
from __future__ import absolute_import
|
|
from __future__ import division
|
|
from __future__ import print_function
|
|
from __future__ import unicode_literals
|
|
|
|
from flask import Markup
|
|
|
|
from superset.exceptions import SupersetException
|
|
from superset.views.base import SupersetModelView
|
|
|
|
|
|
class DatasourceModelView(SupersetModelView):
|
|
def pre_delete(self, obj):
|
|
if obj.slices:
|
|
raise SupersetException(Markup(
|
|
'Cannot delete a datasource that has slices attached to it.'
|
|
"Here's the list of associated charts: " +
|
|
''.join([o.slice_link for o in obj.slices])))
|