-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent people from deleting datasources that have associate slices (#…
- Loading branch information
1 parent
d01e67a
commit a141695
Showing
7 changed files
with
22 additions
and
10 deletions.
There are no files selected for viewing
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from superset.views.base import SupersetModelView | ||
from superset.utils import SupersetException | ||
from flask import Markup | ||
|
||
|
||
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 slices: " + | ||
"".join([o.slice_link for o in obj.slices]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters